File Operations

ln

Create hard and symbolic links between files.

Synopsis

syntax
ln [OPTION]... TARGET LINK_NAME

Examples

Create a symbolic link
ln -s /usr/bin/python3 /usr/local/bin/python
Create a hard link
ln original.txt hardlink.txt
Force update a symbolic link
ln -sf /new/target link
Create relative verbose symlink
ln -srv ../lib/libfoo.so ./libfoo.so

Common options

FlagDescription
-sCreate a symbolic (soft) link
-fForce — remove existing destination files
-vVerbose — print each link created
-rCreate relative symbolic link
-nTreat 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

Related tools