Removing a symbolic link (symlink) deletes only the link itself, not the file or folder it points to. On Linux, macOS, and Windows, the command or action you use is the same as deleting a normal file, with one important exception: you must not add a trailing slash to a directory symlink, or the system may follow the link and delete the target's contents instead. The shortest working method is to open a terminal and run rm linkname (Linux/macOS) or del linkname in Command Prompt (Windows), or to right-click the link in Finder or File Explorer and choose Move to Trash or Delete. Below are the full steps, plus the mistakes that turn a safe deletion into data loss.

What You'll Need

  • Access to a terminal or command prompt (Linux/macOS: Terminal; Windows: Command Prompt or PowerShell).
  • The exact name or path of the symbolic link you want to remove.
  • Basic permission to delete files in the folder containing the link (on Linux/macOS you may need sudo if the link is owned by another user; on Windows you may need administrator rights).
  • Optional: a file manager (Finder on macOS, File Explorer on Windows, or your Linux desktop's file manager) if you prefer a graphical method.

Step-by-Step

  1. Identify the link and its target. Before deleting anything, confirm which item is the symlink. On Linux and macOS, run ls -l in the folder. A symbolic link appears with an l at the start of the permissions string and an arrow pointing to its target, for example mylink -> /home/user/documents. On Windows, open Command Prompt and run dir; symlinks and junctions are marked with <SYMLINK> or <JUNCTION> in the listing. In File Explorer, a symlink usually shows a shortcut-style arrow overlay, but the overlay is not always reliable, so confirm with the command line if you are unsure.
  2. Change to the folder that contains the link. Use cd /path/to/folder on Linux/macOS or cd C:\path\to\folder on Windows. Working from inside the folder lets you use the short link name and reduces the chance of a typo in a long path.
  3. Delete the link with the correct command. On Linux and macOS, run rm linkname. Do not add a trailing slash. On Windows Command Prompt, run del linkname for a file symlink or rmdir linkname for a directory symlink or junction; again, no trailing backslash. In PowerShell, Remove-Item linkname works for both, but be aware that PowerShell may prompt for confirmation on some item types; add -Force only if you are certain of the target. The command removes the link entry only; the target file or folder stays where it is.
  4. Verify the target still exists. Run ls -l (Linux/macOS) or dir (Windows) again. The link should be gone, and the target path should still be present. If you deleted a directory symlink and the target folder is now empty or missing, stop immediately and restore from backup; this indicates the link was followed rather than removed.
  5. Alternative: use a file manager. In Finder on macOS, right-click the link and choose Move to Trash. In File Explorer on Windows, select the link and press Delete. On Linux desktops, right-click and choose Move to Trash or Delete. File managers generally remove the link itself, but confirm by checking that the target is still intact afterward. Note that menu labels differ slightly by version, device, and region.

Common Mistakes

  • Adding a trailing slash to a directory symlink. rm mylink/ can cause the shell or tool to treat the path as the target directory and delete its contents. Always use rm mylink without the slash.
  • Using recursive flags unnecessarily. rm -r on a symlink to a directory may follow the link on some systems and delete the target tree. Plain rm is enough for a link.
  • Confusing hard links with symbolic links. A hard link is another name for the same file data; deleting one hard link does not remove the data while other links exist. Symbolic links are separate entries that point to a path. The commands above remove the symlink entry, not the underlying data.
  • Deleting the target by mistake. If you navigate into the link (for example cd mylink) and then delete files, you are working inside the target. Check pwd after changing directories to confirm where you are.
  • Assuming Recycle Bin or Trash protects you. Command-line deletion is permanent. Use the file manager method if you want a recoverable step.

Tips

  • Use ls -l or dir before and after deletion to confirm you removed the link and not the target.
  • Quote paths that contain spaces: rm "my link".
  • On Windows, run Command Prompt as administrator only if the link is in a protected location; otherwise a standard prompt is safer.
  • If you are cleaning up many links, list them first with find . -type l on Linux/macOS, review the output, then delete individually rather than piping straight to rm.
  • Keep backups of important targets before any bulk cleanup, even though removing a symlink should not touch the target.

Troubleshooting

  • "Permission denied" on Linux/macOS: the link or its parent folder is owned by another user. Use sudo rm linkname only if you understand the ownership, or change ownership of the parent folder. On Windows, open Command Prompt as administrator.
  • "The system cannot find the file specified" on Windows: the link may be a junction rather than a symlink, or you may be in the wrong folder. Run dir /a to show hidden and system items, and confirm the exact name.
  • The link reappears after deletion: something is recreating it, such as a startup script, a package manager, or a sync client. Check scheduled tasks and startup entries, and recreate the link only if you actually need it.
  • You deleted the target by accident: stop using the drive, and restore from backup or a file recovery tool. Command-line deletion does not go to the Recycle Bin.
  • File manager will not delete the link: try the terminal method. Some file managers refuse to delete links that point to protected locations.

Frequently Asked Questions

Does removing a symbolic link delete the original file?

No. Removing the link deletes only the link entry. The target file or folder remains in place unless you separately delete it.

Can I remove a symlink with the same command as a normal file?

Yes. On Linux and macOS, rm removes both. On Windows, del works for file symlinks and rmdir for directory symlinks or junctions.

What happens if I add a trailing slash to a directory symlink?

The shell or tool may follow the link and operate on the target directory's contents instead of the link. Always omit the trailing slash.

How can I tell a symlink from a regular file?

On Linux and macOS, ls -l shows an l at the start of the permissions and an arrow to the target. On Windows, dir marks symlinks and junctions with <SYMLINK> or <JUNCTION>.

Is deleting a symlink reversible?

Command-line deletion is permanent, but you can recreate the link with ln -s target linkname on Linux/macOS or mklink on Windows if you know the original target path. File manager deletion may go to Trash or Recycle Bin, where it can be restored.

Do I need administrator rights to remove a symlink?

Only if the link is in a protected system location or owned by another user. Links in your own home folder or user profile usually do not require elevated rights.