make a symbolic link

Make a name that points to another file or folder, see where a link points, and change or remove it.

files

danger Steps marked danger delete, overwrite or stop something. Read each one before you run it.

steps
  1. ln -s /path/to/target linkname

    make linkname point to the target

  2. ls -l linkname

    see where it points

  3. readlink -f linkname

    the full path it ends up at, through every link

  4. ln -sfn /path/to/other linkname

    point an existing link somewhere else

  5. rm linkname

    danger remove the link; the target stays

  6. ln /path/to/file hardlink

    a hard link instead: another name for the same file, same disk only

notes
  • Remove a link to a folder with rm linkname, without a slash at the end: rm -r linkname/ would delete what is inside the target.
  • A relative target is taken from where the link is, not from where you are.
commands used

lnreadlinkls

Each has a page in lore: lore ln opens it.