How to create and delete soft links under CentOS

Time:2020-1-12

To create a soft link is to use the Ln-S original file or folder target file or folder

Note: because of the limited space, do not change the original program file, and then continue to read the contents of / data / ftp directory, only need to establish a soft connection on / data2 /

Example:

#Establish soft links

mv /data/ftp /data2/

ln -s /data2/ftp  /data/ftp

#Remove soft connection

#When deleting linked files, the original files will be deleted if you are not careful

rm   /data/ftp 

#Only one “/” is missing, which means the linked file is deleted, that is, do not add “/” at the end of the file

Conclusion:

Be careful when deleting files

When deleting a soft link file, be careful to use tab to create it. Be sure not to add “/” to the back of the directory