LN Introduction to Commands:
A hard link is created by default, and a symbolic link is created when you use-S.
1 . Command format:
ln [option] Original file link file path preferably with absolute path
ln original file link file without parameter means create hardware link
-s means creating a soft link
Option (optional):
-S Create soft links
-V Displays the creation process.
Hard Links:
1 , can only create files, can not be applied to the directory;
2 , cannot cross file system;
3 , creating a hard link increases the number of times the file is linked;
Symbolic links (soft links):
1 , can be applied to the directory;
2 , can cross file system;
3 , will not increase the number of links to linked files;
4 , the size of the specified path contains the number of characters;
2 . Command function:
Used to create a linked file that must exist for each specified target when a hard link is created. A symbolic link can point to any location and, when the link resolves correctly, resolves it to a link associated with its parent directory.
3 . Command parameters:
-S Create soft links
-V Displays the creation process.
4 . Command instance:
1. Create a hard link:
ln ABC/TEST/ABC2 The ABC file under the current directory, creating a hard link to the/test directory and named ABC2
Create a hard link whose inode number is consistent
[Email protected] test2]# LN ABC/TEST/ABC2
[Email protected] test2]# cd/test
[Email protected] test]# Ls-li ABC2
2996-rw-r--r--. 2 root root 884 October 15:27 ABC2
[Email protected] test2]# Ls-li ABC
2996-rw-r--r--. 2 root root 884 October 15:27 ABC
2. Create a soft link:
Ln-s/TEST2/ABC2/TEST/ABC3 Create software ABC3 point to ABC2
[Email protected] test2]# ln-s/TEST2/ABC2/TEST/ABC3
3003 lrwxrwxrwx. 1 root root 11 October 15:36 ABC3-/TEST2/ABC2
This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1866782
Linux commands: LN link files--hard links, symbolic links (soft links)