ln

Create hard or symbolic links between files.

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

ln creates links — hard links share the same inode (same data, different name), while symbolic links (-s) are pointers to a path. Symlinks are the standard choice: they work across filesystems, can link directories, and make the relationship explicit.

Common flags
FlagMeaning
-s --symbolicCreate a symbolic link
-f --forceRemove existing destination before linking
-n --no-dereferenceTreat symlink destination as normal file
-v --verbosePrint link names
Examples
ln -s /opt/app/current /opt/app/activeCreate symlink for zero-downtime deploys · explain & risk-check →
ln -sf /etc/nginx/sites-available/app /etc/nginx/sites-enabled/appEnable nginx site via symlink · explain & risk-check →
ln -s $(which python3) /usr/local/bin/pythonCreate python → python3 alias · explain & risk-check →
Pro tip

Use symlinks for version-managed deployments: keep versioned dirs (/opt/app/v1.2.3) and update a single symlink (/opt/app/current) for instant, reversible deploys.

Related
readlink ls cp
Open the full explainer →More in Files & Archives

Reference text is hand-written and may be incomplete — check man ln for your version. Test destructive commands on a non-production system first.