Create hard or symbolic links between files.
medium risk
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.
| Flag | Meaning |
|---|---|
-s --symbolic | Create a symbolic link |
-f --force | Remove existing destination before linking |
-n --no-dereference | Treat symlink destination as normal file |
-v --verbose | Print link names |
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 →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.
Reference text is hand-written and may be incomplete — check man ln for your version. Test destructive commands on a non-production system first.