Remove Symbolic Link (Softlink)

How do I delete symbolic hyperlink (softlink) in Linux working system using a command rapid? How can I take away symbolic hyperlinks in Linux?

A symbolic hyperlink (additionally known as a “delicate hyperlink” or “symlink”) consists of a specific kind of file that serves as a reference to a special file or itemizing. That you must use any one in every of many following command to delete or take away symbolic hyperlinks in Linux working strategies:


  • rm command – Removes each given FILE along with symbolic hyperlinks in Linux.
  • unlink command – Deletes a single specified file determine along with symbolic hyperlinks in Linux.

Enable us to see some examples about to remove (delete) symbolic hyperlinks in Linux.

Warning: Care must be taken with the following rm, unlink, and uncover command as these directions acquired’t rapid for eradicating affirmation. The creator or nixCraft web page simply is not responsible for any data loss. Please use all command with care and assume twice sooner than you press the [Enter] key. Always preserve a verified backup of all data and knowledge.

Linux Delete Symbolic Hyperlink File

Use the following syntax:

rm linkname
unlink linkname


First, we’ll create a model new symbolic hyperlink in Linux using the ln command. Use the cd command to /tmp/ itemizing:

cd /tmp/

## create a model new symbolic for demo operate ##
ln -s /and lots of others/resolv.conf dns

## Guidelines it ##
ls -l dns

Sample outputs:

lrwxrwxrwx 1 vivek vivek 16 2009-08-16 04:28 dns -> /and lots of others/resolv.conf

Now we’ll delete the dns symbolic hyperlink using the rm command or unlink command as follows:

rm dns

## OR ##

unlink dns

Remove Symbolic Link (Softlink)
Affirm it using the ls command:

ls -l dns
ls -l /and lots of others/resolv.conf

Getting affirmation rapid

We’ll energy rapid sooner than every eradicating of symbolic hyperlinks by passing the -i to the rm:
rm -i {link-name}
rm -i -v test-link

rm: take away symbolic hyperlink ‘test-link’? y
eradicated ‘test-link’

Delete Symbolic Hyperlink Itemizing

The syntax is comparable:

rm linkDirName
unlink linkDirName

Please stay away from appending / on the end of linkDirName. cd in to the /tmp/ using the cd command:

cd /tmp/

## create a model new symlink for demo operate ##
ln -s /and lots of others examine

## Guidelines it ##
ls -ld examine

Sample Output:

lrwxrwxrwx 1 vivek vivek 4 2009-08-16 04:31 examine -> /and lots of others

Now delete the examine symbolic hyperlink itemizing using any one in every of many following command:

rm examine

## OR ##

unlink examine

Guarantee symbolic hyperlink is eradicated using the ls command:

Remove Symbolic Link (Softlink)

Take away Symbolic Hyperlinks with uncover command

Proper right here is we’re in a position to search and report all symbolic hyperlinks using the uncover:

uncover {/path/to/dir} -type l -action
uncover {/path/to/dir} -type l -name ‘files-regex-to-search’ -action
uncover {/path/to/dir} -type l -iname ‘Case-Insensitive-files-regex-to-search’ -action
uncover {/path/to/dir} -lname ‘files-regex-to-search’ -action

Say report all symlinks in /tmp/bin/, run:
uncover /tmp/bin/ -type l -print
Solely report *.txt or *.sh symlinks, run:

uncover /tmp/bin/ -type l -iname “*.sh” -print
uncover /tmp/bin/ -type l -iname “*.txt” -print
## trendy syntax for GNU/uncover ##
uncover /tmp/bin/ -lname “*.txt” -print
uncover /tmp/bin/ -lname “*.db” -print
uncover /tmp/bin/ -lname “*.sh” -print

Uncover all symbolic hyperlinks with uncover and delete them

All you need to do is change the -print movement with the -delete as follows to delete all ‘*.sh’ symlinks:
uncover /tmp/bin/ -lname “*.sh” -delete
To get affirmation use the following syntax whenever you may need to uncover all “*.txt” symlinks and delete them:

uncover /tmp/bin/ -type l -name “*.txt” -exec rm -i {} +
uncover /tmp/bin/ -type l -name “*.db” -exec rm -i {} +

Remove Symbolic Link (Softlink)
The place uncover command selections are:

  • -type l : Uncover solely symbolic hyperlink
  • -lname “*.txt” :File is a symbolic hyperlink whose contents match shell pattern akin to “*.txt”. Cross the -ilname “pattern” to the uncover for the case insensitive match. This function solely works the latest mannequin of GNU/uncover.
  • -print : Print matched file lists.
  • -delete : Take away/delete matched symlinks.
  • -exec rm -i {} + : Take away/delete matched symlinks using the rm command with affirmation

Linux Take away Symbolic Hyperlink Command Selections

Type the following command:
rm –help
unlink –help


You found the rm and unlink command to delete or take away a symbolic hyperlink beneath Linux working strategies. See the rm/unlink command man internet web page by typing the following man command or study it on-line proper right here:
man rm
man uncover
man unlink


Posted by: Vivek Gite

The creator is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open provide topics by way of RSS/XML feed or weekly electronic message e-newsletter.

take away symbolic hyperlink linux,take away symbolic hyperlink listing,linux create symbolic hyperlink listing,delete symbolic hyperlink home windows,delete symbolic hyperlink ubuntu,take away symbolic hyperlink mac,deleting a tender hyperlink mcq,deleting a tender hyperlink examvedaremove symbolic link linux,remove symbolic link directory,linux create symbolic link directory,create symbolic link linux,remove symbolic link ubuntu,remove symbolic link windows,remove symbolic link mac,deleting a soft link mcq