Use the LN command to create a link to a file in Linux (soft links or hard links)
Use of hard Links:
?
| 1 |
[email protected]:~# ln 2.txt e.txt |
?
| 1 2 |
[email protected]:~# ls1.txt 2.txt 3.txt 4.txt 5.txt 5.txt~ e.txt test |
?
| 1 2 3 4 5 6 7 8 9 10 11 |
[email protected]:~# cat 2.txt 在li上,安装软件一共有三种方式: 1.源代码安装 2.包安装 3.apt在线安装 [email protected]:~# cat e.txt 在li上,安装软件一共有三种方式: 1.源代码安装 2.包安装 3.apt在线安装[email protected]:~# |
Use of soft Links:
?
| 1 2 3 4 5 6 7 8 9 10 11 12 |
[email protected]:~# ln -s 2.txt evilxr [email protected]:~# ls -l total 32 -rw-r--r-- 1 root root 101 5月 29 10:03 1.txt -rw-r--r-- 2 root root 96 5月 29 10:46 2.txt -rw-r--r-- 1 root root 115 5月 29 10:56 3.txt -rw-r--r-- 1 root root 181 5月 29 11:12 4.txt -rw-r--r-- 1 root root 2717 5月 29 12:00 5.txt -rw-r--r-- 1 root root 18 5月 29 11:51 5.txt~ -rw-r--r-- 2 root root 96 5月 29 10:46 e.txt lrwxrwxrwx 1 root root 5 6月 2 13:01 evilxr -> 2.txt drwxr-xr-x 2 root root 4096 5月 29 10:17 test |
?
| 1 2 3 4 5 6 |
[email protected]:~# cat evilxr 在li上,安装软件一共有三种方式: 1.源代码安装 2.包安装 3.apt在线安装[email protected]:~# |