ln — symbolic and hard links
cheat sheet · GNU coreutils https://lab.dimsanych.ru/en/wiki/ln/Cheat sheet
-
ln -s /opt/app/current/bin/app /usr/local/bin/appsymlink (order like cp) -
ln -sf /new/target linkrecreate it -
readlink -f linkthe real path -
ln file hardnamea hard link -
find . -xtype lfind broken symlinks
Options
-s is the one option that makes a symlink instead of a hard link; without
it ln creates a hard link. -f overwrites an existing link name — without
confirmation, so it's risky with someone else's or important files. -n
matters specifically when replacing a symlink that points to a directory:
without it, ln -sf target dir drops the new link inside dir instead of
replacing dir itself.