First, Introduction
The ln command is used to create a link between a file, a soft link (similar to a shortcut in a Windows system), and a hard link (equivalent to a source file copy), which uses hard links by default.
Ii. Methods of Use
Syntax: ln [options] [file] option:-S creates a soft link to the source file
Third, the case:
1. Creating a soft link to a file
[[email protected] ~]# ln-s/root/student.sql/root/db/ln.sql[[email protected] ~]# ls-lh db/ln.sql lrwxrwxrwx 1 root ro OT 17 February 15:31 Db/ln.sql-/root/student.sql
2. Create a soft link to the catalog
[[email protected] ~]# ln-s db data[[email protected] ~]# ll-h data/lrwxrwxrwx 1 root root 17 February 15:31 ln.sql-&G T /root/student.sql[[email protected] ~]# ln student.sql db/
3. Create a hard link to a file
[[Email protected] ~]# ln student.sql db/[[email protected] ~]# ls-lh db/lrwxrwxrwx 1 root root 17 February 15:31 Ln . sql-/root/student.sql-rw-r--r--2 root root 2.9K February 10:17 student.sql
Third, soft and hard link description
Soft Link: Can not delete the source file, delete the source file causes the link file cannot be found, the file appears red flashing
Hard Link: Can delete source file, link file can open normally
The ln command for Linux