RHCSA软硬链接

[C:\~]$ ssh 192.168.159.128


Connecting to 192.168.159.128:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Fri Mar 10 06:57:46 2023 from 192.168.159.1
[root@localhost ~]# cd /
[root@localhost /]# ls
a    bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
afs  boot  etc  lib   media  opt  root  sbin  sys  usr
[root@localhost /]# mkdir /test
[root@localhost /]# ls
a    bin   dev  home  lib64  mnt  proc  run   srv  test  usr
afs  boot  etc  lib   media  opt  root  sbin  sys  tmp   var
[root@localhost /]# cd /test/
[root@localhost test]# touch a
[root@localhost test]# ls
a
[root@localhost test]# ln /test/a a.hard
[root@localhost test]# ls
a  a.hard
[root@localhost test]# ln -s/test/a a.soft
ln: invalid option -- '/'
Try 'ln --help' for more information.
[root@localhost test]# ln -s /test/a a.soft
[root@localhost test]# ll
total 0
-rw-r--r--. 2 root root 0 Mar 10 07:02 a
-rw-r--r--. 2 root root 0 Mar 10 07:02 a.hard
lrwxrwxrwx. 1 root root 7 Mar 10 07:03 a.soft -> /test/a
[root@localhost test]# 
[root@localhost test]# stat a a.hard a.soft
  File: a
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:02:37.055865472 -0500
Modify: 2023-03-10 07:02:37.055865472 -0500
Change: 2023-03-10 07:02:54.044963914 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.hard
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:02:37.055865472 -0500
Modify: 2023-03-10 07:02:37.055865472 -0500
Change: 2023-03-10 07:02:54.044963914 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.soft -> /test/a
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 35009276    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:03:53.190869902 -0500
Modify: 2023-03-10 07:03:49.431812324 -0500
Change: 2023-03-10 07:03:49.431812324 -0500
 Birth: 2023-03-10 07:03:49.431812324 -0500
[root@localhost test]# echo 123 > a
[root@localhost test]# cat a a.hard a.soft
123
123
123
[root@localhost test]# echo 222 > a.hard
[root@localhost test]# cat a a.hard a.soft
222
222
222
[root@localhost test]# stat a a.hard a.soft
  File: a
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.hard
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.soft -> /test/a
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 35009276    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:03:53.190869902 -0500
Modify: 2023-03-10 07:03:49.431812324 -0500
Change: 2023-03-10 07:03:49.431812324 -0500
 Birth: 2023-03-10 07:03:49.431812324 -0500
[root@localhost test]# stat a a.hard .,soft
  File: a
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.hard
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
stat: cannot statx '.,soft': No such file or directory
[root@localhost test]# stat a a.hard a.soft
  File: a
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.hard
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 35009228    Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:05:28.479876743 -0500
Modify: 2023-03-10 07:05:20.631884659 -0500
Change: 2023-03-10 07:05:20.631884659 -0500
 Birth: 2023-03-10 07:02:37.055865472 -0500
  File: a.soft -> /test/a
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 35009276    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 07:03:53.190869902 -0500
Modify: 2023-03-10 07:03:49.431812324 -0500
Change: 2023-03-10 07:03:49.431812324 -0500
 Birth: 2023-03-10 07:03:49.431812324 -0500
[root@localhost test]# mkdir -p air/aaa
[root@localhost test]# ls
a  a.hard  air  a.soft
[root@localhost test]# ls /test/
a  a.hard  air  a.soft

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值