Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cloud Computing Learning Route course outline Courseware: file Link

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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/

=

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report