软硬链接实验

[root@localhost /]# cd /test/
[root@localhost test]# ls
[root@localhost test]# touch a
[root@localhost test]# ls
a
[root@localhost test]# stat a
  File: a
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 467308      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 19:46:34.327359828 +0800
Modify: 2023-03-10 19:46:34.327359828 +0800
Change: 2023-03-10 19:46:34.327359828 +0800
 Birth: 2023-03-10 19:46:34.327359828 +0800
[root@localhost test]# ln /test/a a.hard
[root@localhost test]# ls
a  a.hard
[root@localhost test]# ln -s /test/a a.soft
[root@localhost test]# ls
a  a.hard  a.soft
[root@localhost test]# ll
total 0
-rw-r--r--. 2 root root 0 Mar 10 19:46 a
-rw-r--r--. 2 root root 0 Mar 10 19:46 a.hard
lrwxrwxrwx. 1 root root 7 Mar 10 19:56 a.soft -> /test/a
[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: 467308      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 19:46:34.327359828 +0800
Modify: 2023-03-10 19:46:34.327359828 +0800
Change: 2023-03-10 19:52:31.439550462 +0800
 Birth: 2023-03-10 19:46:34.327359828 +0800
  File: a.hard
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 467308      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 19:46:34.327359828 +0800
Modify: 2023-03-10 19:46:34.327359828 +0800
Change: 2023-03-10 19:52:31.439550462 +0800
 Birth: 2023-03-10 19:46:34.327359828 +0800
  File: a.soft -> /test/a
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 467290      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 19:56:53.124414767 +0800
Modify: 2023-03-10 19:56:31.493597839 +0800
Change: 2023-03-10 19:56:31.493597839 +0800
 Birth: 2023-03-10 19:56:31.493597839 +0800
[root@localhost test]# echo 123 > a
[root@localhost test]# cat a.a.hard a.soft
cat: a.a.hard: No such file or directory
123
[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]# rm a
rm: remove regular file 'a'? y
[root@localhost test]# ls
a.hard  a.soft
[root@localhost test]# ll
total 4
-rw-r--r--. 1 root root 4 Mar 10 20:12 a.hard
lrwxrwxrwx. 1 root root 7 Mar 10 19:56 a.soft -> /test/a
[root@localhost test]# cat a a.hard a.soft
cat: a: No such file or directory
222
cat: a.soft: No such file or directory
[root@localhost test]# echo 123 > a
[root@localhost test]# ls
a  a.hard  a.soft
[root@localhost test]# ll
total 8
-rw-r--r--. 1 root root 4 Mar 10 20:42 a
-rw-r--r--. 1 root root 4 Mar 10 20:12 a.hard
lrwxrwxrwx. 1 root root 7 Mar 10 19:56 a.soft -> /test/a
[root@localhost test]# cat a a.hard a.soft
123
222
123
[root@localhost test]# stat a a.hard a.soft
  File: a
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 467310      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 20:42:46.602221023 +0800
Modify: 2023-03-10 20:42:46.579221214 +0800
Change: 2023-03-10 20:42:46.579221214 +0800
 Birth: 2023-03-10 20:42:46.579221214 +0800
  File: a.hard
  Size: 4         	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 467308      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 20:42:46.562221356 +0800
Modify: 2023-03-10 20:12:01.917723095 +0800
Change: 2023-03-10 20:42:46.535221581 +0800
 Birth: 2023-03-10 19:46:34.327359828 +0800
  File: a.soft -> /test/a
  Size: 7         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 467290      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-03-10 19:56:53.124414767 +0800
Modify: 2023-03-10 19:56:31.493597839 +0800
Change: 2023-03-10 19:56:31.493597839 +0800
 Birth: 2023-03-10 19:56:31.493597839 +0800

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值