码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 命令ln

时间:2014-06-02 15:34:45      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:c   class   blog   code   java   a   

在linux中可用ln命令创建一个文件的链接(软链接或者硬链接)

硬链接的使用:

1
root@IdeaPad:~# ln 2.txt e.txt
1
2
root@IdeaPad:~# ls
1.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 evilxr
root@IdeaPad:~# 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
root@IdeaPad:~# cat evilxr
在li上,安装软件一共有三种方式:
1.源代码安装
2.包安装
3.apt在线安装
root@IdeaPad:~#

 

 

Linux 命令ln,布布扣,bubuko.com

Linux 命令ln

标签:c   class   blog   code   java   a   

原文地址:http://www.cnblogs.com/evilxr/p/3764253.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!