In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to remove symbolic links in Linux". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and study and learn "how to remove symbolic links in Linux" together.
What is a symbolic link?
Symlink, also known as soft link, is a special file type that points to another file or directory in Linux. It is similar to shortcuts in Windows. It can point to a file or directory in the same or different file system or partition.
Symbolic links are usually used to link library files. It can also be used to link log files and folders on mounted NFS (Network File System).
What is rm command?
The rm command is used to remove files and directories. It is very dangerous and you should be very careful every time you use the rm command.
What is the unlink command?
The unlink command is used to remove special files. It is installed as part of GNU Gorutils.
1)How to remove symbolic link files using rm command
The rm command is the most frequently used command in Linux and allows us to remove symbolic links as described below.
# rm symlinkfile
Always use the rm command with-i to understand what is being done.
# rm -i symlinkfile1rm: remove symbolic link ‘symlinkfile1’? y
It allows us to remove multiple symbolic links at once:
# rm -i symlinkfile2 symlinkfile3 rm: remove symbolic link ‘symlinkfile2’? yrm: remove symbolic link ‘symlinkfile3’? y1a) How to remove symlink directories using rm command
This is like removing a symbolic link file. Use the following command to remove the symlink directory.
# rm -i symlinkdir rm: remove symbolic link ‘symlinkdir’? y
Use the following command to remove multiple symlink directories.
# rm -i symlinkdir1 symlinkdir2 rm: remove symbolic link ‘symlinkdir1’? yrm: remove symbolic link ‘symlinkdir2’? y
If you add/at the end, the symlink directory will not be deleted. If you add, you will get an error.
# rm -i symlinkdir/ rm: cannot remove ‘symlinkdir/’: Is a directory
You can add-r to deal with this problem. But if you add this parameter, it will delete the contents of the target directory, and it will not delete the symbolic link file. This may not be what you meant.
# rm -ri symlinkdir/ rm: descend into directory ‘symlinkdir/’? yrm: remove regular file ‘symlinkdir/file4.txt’? yrm: remove directory ‘symlinkdir/’? yrm: cannot remove 'symlinkdir/': Not a directory2) How to remove symbolic links using the unlink command
The unlink command deletes the specified file. It accepts only one file at a time.
Delete Symbolic Link File:
# unlink symlinkfile
Delete Symbolic Link Directory:
# unlink symlinkdir2
If you add/to the end, you cannot delete a symlink directory using the unlink command.
# unlink symlinkdir3/ unlink: cannot unlink 'symlinkdir3/': Not a directory Thank you for reading, the above is "how to remove symbolic links in Linux" content, after learning this article, I believe that everyone on how to remove symbolic links in Linux this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.