Linux link command

Updated: 05/04/2019 by Computer Hope
link command

On Unix-like operating systems, The link command associates a file with a file name in a file system.

This page describes the GNU/Linux version of link.

Description

The link command creates a hard link named FILE2, which shares the same index node as the existing file FILE1. Since FILE1 and FILE2 share the same index node, they point to the same data on the disk, and modifying one is functionally the same as modifying the other.

This is distinct from creating a "soft" symbolic link to a file, which creates its own index node and does not directly point to the same data.

For example, a user cannot create a hard link which links to a directory, but this can be accomplished using a symbolic link.

Syntax

link FILE1 FILE2
link OPTION

Options

--help Display help and exit.
--version Display version information, and exit.

Examples

link computer.txt hope.txt

The example above would create the file hope.txt linked to the file computer.txt. Any changes that occurred with either of these files would affect the other file or link.

ln — Create a link, or a symbolic link, to a file or directory.
ls — List the contents of a directory or directories.
unlink — Remove a file.