Name

ln

Synopsis

    ln [options] existing new
    ln [options]files directory

Create pseudonyms (links) for files, allowing them to be accessed by different names. In the first form, link existing to new, where new is usually a new filename. If new is an existing file, it is removed first; if new is an existing directory, a link named existing is created in that directory. In the second form, create links in directory, each link having the same name as the file specified.

Common Options

-f, --force

Force the link to occur (don’t prompt for overwrite permission).

-s, --symbolic

Create a symbolic link. This lets you link across filesystems and also see the name of the link when you run ls -l. (Otherwise, you have to use find -inum to find any other names a file is linked to.)

Solaris Option

-n

/usr/bin/ln: Do not overwrite existing files.

GNU/Linux and Mac OS X Options

-i, --interactive

Prompt for permission before removing files.

-v, --verbose

Verbose mode. List files as they are processed.

GNU/Linux Options

-b, --backup[=control]

Back up any existing files. When using the long version of the option, the optional control parameter controls the kind of backup. When no control is specified, ln attempts to read the control value from the VERSION_CONTROL environment variable. Accepted values are:

none, off

Never make backups.

numbered, t

Make numbered backups.

existing, nil

Match existing backups, numbered or simple.

simple, never

Always make simple backups.

-d, -F, --directory

Allow hard links to directories. ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.