Create a symbolic link

Low risk
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Creates a symlink so a file or directory is reachable from another path — commonly used for dotfiles, shared configs, and versioned tool installs.

filessymlinklink

Parameters

Existing file or directory the link should point to.

Path of the new symlink to create.

Commands

Confirm the target exists before linking to it

ls -ld "<target>"

Create the symbolic link

ln -s "<target>" "<link>"

Verification

ls -l "<link>"

The link is shown with an arrow pointing at the target path.

Undo

Remove the symlink; the target is untouched

rm "<link>"

Pitfalls

  • A relative target is resolved from the link's directory, not your current directory — prefer absolute targets unless you want the link to be relocatable.
  • ln -s does not fail if the target does not exist; you get a broken link.
  • On Windows, creating symlinks requires Developer Mode or an elevated PowerShell.
  • Never rm -r a symlink to a directory with a trailing slash — some shells resolve it and delete the target's contents.

Related