Skip to content
Follow
Ubuntu Linux

How to Remove Symbolic Links in Ubuntu Linux

Richard
Written by
Richard
Jan 24, 2024 Updated Jul 13, 2026 3 min read
Enable Automatic Suspension in Ubuntu Linux Easily
Enable Automatic Suspension in Ubuntu Linux Easily

Removing symbolic links in Ubuntu Linux uses a simple command to delete shortcut files.

A symbolic link, or symlink, is like a shortcut that points from one location on your computer to a different file or folder. For example, a symlink pointing to `/home/user/documents` might be named `docs` in Ubuntu 22.04 LTS.

You’ll want to delete these links when the original file or folder is no longer there, helping to keep your system organized.

Deleting a symlink removes only the shortcut itself, not the actual file or folder it pointed to, so your important data stays safe.

⚡ Quick Answer

Use the `rm` command followed by the symbolic link’s name in the terminal. Alternatively, the `unlink` command can also remove a symbolic link. This action deletes only the link, not the original file or directory it points to.

Open the terminal

Open the terminal. The Ubuntu terminal is a powerful tool for command-line tasks, serving as your gateway to performing complex operations. To open the terminal on Ubuntu, press **Ctrl+Alt+T** simultaneously. This keyboard shortcut directly launches the terminal application, allowing you to execute commands without needing to use your mouse.

  • Press Ctrl+Alt+T on your keyboard. This keyboard shortcut launches the terminal window.

To remove a symbolic link in Ubuntu, first navigate to the folder where it’s stored. The cd command (change directory) is used for this. For example, if your symbolic link resides in the Downloads folder, you would enter: `cd ~/Downloads` and press Enter.

Next, navigate to the directory housing your symbolic link. The cd command is used for this. For example, if your symlink resides in your Downloads folder, you would enter: `cd ~/Downloads`.

Command Prompt
cd ~/Downloads

Remember to replace ~/Downloads with the actual path to the directory containing your symbolic link.

The `ls -l` command lists files and clearly identifies symbolic links within Ubuntu Linux. Symbolic links begin with the letter ‘l’. This check confirms you’ve identified the correct link before proceeding with deletion.

🐧Bash / Shell
ls -l

Look for entries that start with lrwx, indicating they are symbolic links.

🐧Bash / Shell
ls -l /usr/bin/python

The output will also show where the link points to.

💻Code
lrwxrwxrwx 1 root root 12 Apr 16  2023 /usr/bin/python -> python2.7

Removing a symbolic link in Ubuntu is accomplished with the rm command. Type rm symlink_name, substituting symlink_name with the actual name of your link. This command deletes only the link, not the original file or folder it referenced.

💻Code
rm symlink_name

Replace symlink_name with the actual name of your symbolic link. This command removes the symlink itself, not the target file or directory.

💡Tip
To get prompted before removing the symlink, use the -i option:
💻Code
rm -i symlink_name

Another way to remove a symbolic link in Ubuntu is with the unlink command. This command is made specifically for deleting symbolic links, and it handles one link at a time. To delete a symlink, type unlink symlink_name and press Enter.

The unlink command is a bit more focused; it can only handle one symlink at a time.

To delete a symbolic link, run the unlink command followed by the symlink name as an argument:

💻Code
unlink symlink_name

That should do it!

Conclusion:

  • Removing symbolic links in Ubuntu Linux is essential for maintaining a clean and efficient file system.
  • Properly managing symbolic links helps reduce clutter, improve system performance, and avoid confusion when accessing files and directories.
  • The rm command or the unlink command can remove symbolic links based on your specific requirements.
  • Always exercise caution when removing symbolic links to ensure you do not inadvertently delete essential files or directories.
  • Feel free to share your feedback or tips in the comments section below.

To remove all symbolic links in Ubuntu, you can use either the ‘unlink’ or ‘rm’ commands, but ‘unlink’ is safer as it can’t delete directories.

To remove a symbolic link, use rm or unlink followed by the symlink name. Do not append a trailing slash when removing a symlink that points to a directory. Use find /path -xtype l when you need to clean up broken links after moving or deleting target files.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Delete Files and Folders in Windows 11
Windows How to Delete Files and Folders in Windows 11
How to Unlink OneDrive Windows 11: A Complete Guide
Windows How to Unlink OneDrive Windows 11: A Complete Guide

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *