Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to implement Linux to create soft links and hard links to files or directories

Shulou Source: shulou.com Published: 2022-06-01 07:57:47 10月04日 Update

This article mainly explains "how to achieve Linux to files or directories to create soft links, hard links", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to achieve Linux to files or directories to create soft links, hard links" it!

The following command is used when we need to use the same file in different directories.

Command: ln

Function: to establish a synchronous link for a file in another location

Syntax: ln [option] source file target file

Description: (1) synchronization: if you change one place, other links will also change.

(2) soft link: ln-s source file target file, establish a virtual link under the target file (shortcut key)

Hard link: ln source file target file, create a file the same size as the source file under the target file (real)

Commonly used: ln-s source file target file

For example: ln-s / home/fei/workspace / var/www# create a workspace shortcut in the var/www folder

Note: file permissions issue, provided / home/fei/workspace is accessible

Thank you for your reading, the above is "how to achieve Linux to files or directories to create soft links, hard links" of the content, after the study of this article, I believe you on how to achieve Linux to files or directories to create soft links, hard links to this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Files links targets directories source files learning content commands shortcuts questions synchronization differences locations functions premises synchronization size that is commonly used ideas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info NVidia Shulou Information Redmi