1. Function: Link a file or folder to another file or folder. Links are broken down into hard links and soft links, and hard links can be viewed as a single entry with multiple accesses to a file, and soft links as shortcuts.
2. Usage: ln [option] source file or directory destination file or directory
3. Parameters:
-P,--physical hard links
-S,--symbolic soft link
4. Example
Example 1: Creating a hard link and a soft link, respectively
[email protected] test]# echo "Today is Tuesday" >>test_1.txt
[email protected] test]# cat Test_1.txt
Today is Tuesday
[email protected] test]# ls-lh
Total dosage 4.0K
-rw-r--r--1 root root 17 May 17:36 Test_1.txt
[email protected] test]# ln test_1.txt hard_test.txt
[email protected] test]# ls-lh
Total dosage 8.0K
-rw-r--r--2 root root 17 May 17:36 Hard_test.txt
-rw-r--r--2 root root 17 May 17:36 Test_1.txt
[email protected] test]# ln-s test_1.txt soft_test.txt
[email protected] test]# ls-lh
Total dosage 8.0K
-rw-r--r--2 root root 17 May 17:36 Hard_test.txt
lrwxrwxrwx 1 root root 10 May 17:38 Soft_test.txt-Test_1.txt
-rw-r--r--2 root root 17 May 17:36 Test_1.txt
Example 2: After deleting test_1.txt, the hard-linked files can be accessed normally, and the contents are the same as the contents of the source file, the file can be accessed normally, but the file color of the soft link is changed.
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m01/80/32/wkiol1c66ipbsrrtaaalomw7ib0033.png "title=" Clipboard.png "alt=" Wkiol1c66ipbsrrtaaalomw7ib0033.png "/>
Linux Common Commands Summary--ln