在linux中可用ln命令创建一个文件的链接(软链接或者硬链接)
硬链接的使用:
|
1 |
root@IdeaPad:~# ln 2.txt e.txt |
|
1
2 |
root@IdeaPad:~# 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 |
root@IdeaPad:~# cat 2.txt在li上,安装软件一共有三种方式:1.源代码安装2.包安装3.apt在线安装root@IdeaPad:~# cat e.txt 在li上,安装软件一共有三种方式:1.源代码安装2.包安装3.apt在线安装root@IdeaPad:~# |
软链接的使用:
|
1
2
3
4
5
6
7
8
9
10
11
12 |
root@IdeaPad:~# ln -s 2.txt evilxrroot@IdeaPad:~# ls -ltotal 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.txtlrwxrwxrwx 1 root root 5 6月 2 13:01 evilxr -> 2.txtdrwxr-xr-x 2 root root 4096 5月 29 10:17 test |
|
1
2
3
4
5
6 |
root@IdeaPad:~# cat evilxr在li上,安装软件一共有三种方式:1.源代码安装2.包安装3.apt在线安装root@IdeaPad:~# |
原文地址:http://www.cnblogs.com/evilxr/p/3764253.html