ln
Create hard and symbolic links between files.
Synopsis
ln [OPTION]... TARGET LINK_NAME
Examples
ln -s /usr/bin/python3 /usr/local/bin/python
ln original.txt hardlink.txt
ln -sf /new/target link
ln -srv ../lib/libfoo.so ./libfoo.so
Common options
| Flag | Description |
|---|---|
| -s | Create a symbolic (soft) link |
| -f | Force — remove existing destination files |
| -v | Verbose — print each link created |
| -r | Create relative symbolic link |
| -n | Treat destination as normal file if it is a symlink |
About ln
The `ln` command create hard and symbolic links between files. File operation commands are essential for navigating and managing the Linux filesystem.
They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man ln`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More File Operations Commands
Other commands in the File Operations category