Intermediate Package: coreutils

ln

Create hard or symbolic links between files.

Syntax

ln [options] target link_name

Description

ln creates a link โ€” a second name that points to the same file. A symbolic link (-s) is a pointer to a path and can cross filesystems or point to directories; a hard link is a second directory entry for the same underlying data.

Examples

ln -s /opt/app/current /usr/local/bin/app
Create a symbolic link (most common form)
ln file.txt file-hardlink.txt
Create a hard link to a file
ls -l /usr/local/bin/app
Confirm a symlink and see what it points to

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux