软硬链接的实验

[root@localhost /]# cd /test/
[root@localhost test]# touch 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]# 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