Linux Command Ln

Source: Internet
Author: User

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]:~#

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.