Linux to create file or directory soft links, hard link skills

  

Sometimes Linux users want to create soft links or hard links to files or directories on the computer for ease of use. But what if some users don't know how to create soft links or hard links to these files or directories? Don't worry, now Xiaobian will teach you how to solve it.

Solution:

When we need to use the same file in different directories, will use the following command.

Command: ln

Function: Create a synchronous link for another file in another location

Syntax: ln [option] Source file target file

Description: (1) Synchronization: change one place, other links will change accordingly;

(2) Soft link: ln -s source file target file, create virtual link under the target file (shortcut key)

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

Commonly used: ln -s source file object file

Example: ln -s /home/fei/workspace /var/www#Create a shortcut to the workspace in the var/www folder

Note: File permissions issue, prerequisite /home /fei/workspace is accessible.

This is how to create a soft link or hard link in a Linux computer. Users who don't know how to create it will be created as described above.

Copyright © Windows knowledge All Rights Reserved