Cloud Computing Learning Route course outline Courseware: file Link
Cloud Computing Learning Route course outline Courseware: file Link
=
Soft links or symbolic links
Hard link
Symbolic links symbolic link soft connections
[root@tianyun ~] # echo 111 > / file1
[root@tianyun] # ln-s / file1 / home/file11
[root@tianyun ~] # ll / home/file11
Lrwxrwxrwx 1 root root 6 Dec 20 17:58 / home/file11-> / file1
[root@tianyun] # ll-I / file1 / home/file11
4599081-rw-r--r-- 1 root root 4 Dec 20 17:57 / file1
135 lrwxrwxrwx 1 root root 6 Dec 20 17:58 / home/file11-> / file1
[root@tianyun ~] # cat / file1
one hundred and eleven
[root@tianyun ~] # cat / home/file11
one hundred and eleven
[root@tianyun ~] # rm-rf / file1
[root@tianyun ~] # ll / home/file11
Lrwxrwxrwx 1 root root 6 Dec 20 17:58 / home/file11-> / file1
II. Hard links
4 / etc/file1 4 / usr/file1-h
[root@tianyun ~] # echo 222 > / file2
[root@tianyun ~] # ln / file2 / file2-h2
[root@tianyun ~] # ln / file2 / home/file2-h3
Ln: failed to create hard link'/ home/file2-h3' = >'/ file2': Invalid cross-device link
[root@tianyun ~] # ln / file2 / etc/file2-h4
[root@tianyun ~] # echo 222 > / file2
[root@tianyun ~] # ln / file2 / file2-h2
[root@tianyun ~] # ln / file2 / home/file2-h3
Ln: failed to create hard link'/ home/file2-h3' = >'/ file2': Invalid cross-device link
[root@tianyun ~] # ln / file2 / etc/file2-h4
[root@tianyun] # ll-I / file2 / file2-h2 / etc/file2-h4
4599081-rw-r--r-- 3 root root 4 Dec 20 18:03 / etc/file2-h4
4599081-rw-r--r-- 3 root root 4 Dec 20 18:03 / file2
4599081-rw-r--r-- 3 root root 4 Dec 20 18:03 / file2-h2
Make multiple links to some important documents
Note: hard link
Cannot cross file systems (partitions)
Hard links in directories are not supported.
[root@tianyun home] # ln / home/ / mnt
Ln: "/ home/": hard links to directories are not allowed
Warning: when deleting a directory softchain:
Mkdir / home/it1000touch / home/it1000/file {1.. 10} ln-s / home/it1000/ / var/
Rm-rf / var/it1000/ delete files in the directory
Rm-rf / var/it1000 deletes only the linked file itself
[root@tianyun] # ln-s / etc / home/
[root@tianyun ~] # rm-rf / home/etc/
=