safest method to remove softlink in linux

In this post we will learn safest method to remove softlink in linux. Softlink is also known as symbolic link which is special type of file provide the reference of file or directory with its absolute path.When you run the command ls -la filename-or-DirectoryName in output you may observe l letter as prefix in permission mode field.
In some tutorial you may also find the rm command to remove softlink but rm command is also used for removing file or directory.So here the person can do human reading mistake like without checking about the file or directory is softlink or symbolic link.the person may remove file/directory. To avoid such kind of accidental human reading mistake it is recommended to use unlink command for removing softlink

To remove softlink by safest method,use below given syntax

unlink softlink-file-name

Find the given below screenshot for reference.

In below given screenshot,we created a new softlink called yes.txt and later we have removed it by using unlink command.

unlink command

2 thoughts on “safest method to remove softlink in linux”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.