Detailed example of how to perform soft connection in Linux

In the Linux system, you can use lnthe command to make a soft link.

lnThe syntax of the command is as follows:

ln -s source_file link_name

Among them, source_fileis the path of the source file, and link_nameis the name and path of the soft link file.

For example, if you want to /home/user/file1make a soft link to /home/user/link1, you can enter the following command in the terminal:

ln -s /home/user/file1 /home/user/link1

This creates a link1soft link file named , pointing to /home/user/file1. It should be noted that the name and path of the soft link file cannot be the same as that of an existing file or directory, otherwise conflicts will occur.

You can also use relative paths to create soft links, for example:

cd /home/user
ln -s file1 link1

link1This will create a soft link file named in the current directory , pointing to file1the file.

ln -sIn short, it is very convenient to create a soft link through the command, so as to achieve quick access between files.

Guess you like

Origin blog.csdn.net/qq_37037348/article/details/130724051