How to Remove Bad Symbolic Links in Linux

Written by jamie wilson
  • Share
  • Tweet
  • Share
  • Email

Symbolic links are like shortcuts in Linux, which can point to either files or directories located on the same computer, on another device, or somewhere across the network. They are incredibly useful, but unlike hard links, symbolic links do not automatically update if the target file or directory is moved. This can create broken links that point to locations that no longer exist. Fortunately, deleting these broken links is a simple process.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Open a terminal window so you can work from the command line.

  2. 2

    Navigate to the directory containing the bad symbolic link by typing "cd <DIRECTORY>" and pressing "Enter."

  3. 3

    Type "ls -lha <LINK>" if you want to see what the symbolic link points to. It will look like this:

    <LINK> -> <DESTINATION>

  4. 4

    Type "rm <SYMBOLIC LINK>" and press "Enter." This will delete the symbolic link.

Tips and warnings

  • If you know exactly where the symbolic link is located, you can simply type "rm //" and press "Enter." This will delete the link without your having to navigate to it.
  • The "rm" tool will not ask for confirmation before deleting unless the "-i" option is used. Be absolutely sure you wish to delete something before you press "Enter." Items deleted with this tool will not be sent to the trash folder.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.