[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
RHCSA软硬链接
最新推荐文章于 2024-03-26 20:51:38 发布