Link command
Article Directory
learning target
- Able to say way to create a soft link
- Able to say way to create hard links
Introduction 1. Link command
Links command is to create a file link, the link file is divided into:
- Soft links
- Hard links
command | Explanation |
---|---|
LN -s | Create a soft link |
ln | Create a hard link |
2. Soft Links
Similar to the shortcuts in Windows , when a source file directory level deeper, we want to facilitate the use of it can create a soft link to the source file.
Soft links renderings:
Precautions:
- If the soft link and source files are not in the same directory as the source file using the absolute path, you can not use relative paths.
- Delete the source file is a soft link failure
- You can create a soft link to the directory
3. soft links Summary
- The role of soft links is to facilitate quick access to files, such as: a complex next to the file path to create a soft link, since you can quickly access complete the operation by soft links.
- Format command to create a soft link: ln -s source file path (using an absolute path) soft links
4. hard link
Similar to an alias of the source file , which means that the two names pointing to the same data file.
Hard link renderings:
Precautions:
- Create a hard link using relative and absolute paths can be
- Delete files, hard links can also access the data.
- Create a hard link, hard link count plus 1, delete the source files or hard links, hard links will be reduced by 1.
- Create soft links, hard links will not add 1
- You can not create hard links to directories
Hard link count:
The number used by the file name is the number of hard links to the file data, like reference count
5. hard links Summary
- Hard link role is to create a hard link to important documents, to prevent data files from accidental deletion.
- Delete files, soft link failure, but still can use hard links.
- Create a hard link command format: ln source file path hard links