Linux – How to remove a Symbolic Link (Softlink)
Under Linux, Symbolik Link is a great feature. This feature also exists in Windows.
In this post I will show you how to remove a Symbolic Link (safely) in Linux.
There are two commands, the first, the most know is the command rm, the second is the command unlink (a cool and secure command).
Don't worry the command rm don't remove your original file/directory, the rm command just removes the Symbolic Link.
For example, I would like to remove the link “link_to_original”
florian@linux-desktop:~/Documents$ ls -lh
drwxr-xr-x 5 florian florian 4,0K avril 24 22:07 Ansible
drwxrwxr-x 3 florian florian 4,0K avril 20 22:36 import
lrwxrwxrwx 1 florian florian 9 avril 26 21:03 link_to_original -> original/
drwxrwxr-x 2 florian florian 4,0K avril 26 21:03 original
Use the command rm :
florian@linux-desktop:~/Documents$ rm ./link_to_link
Use the command unlink :
florian@linux-desktop:~/Documents$ unlink ./link_to_link
The both commands work fine with a symbolic link associated to a file or a directory.