Search notes:

Shell command: ln

ln makes links between files.

-s

$ ln -s $target $symbolic_link_file
$target can be any name. It's not resolved until $symbolic_link_file is accessed.
$ mkdir x y
$ echo hello > x/to
$ ln -s x/to y/from
$ cat y/from              # Error: no such file or directory!
$ rm y/from
$ ln -s ../x/from y/from
$ cat y/from              # Prints 'hello'
$ cd y
$ cat from                # Prints 'hello'
After creating the symbolic link, the target of the link can be determined with readlink -f

-r

-r creates the symbolic links relative to the link location.

Create symbolic links from ~/bin to executables under a given directory

find $DIR -type f -executable -exec ln -s {} ~/bin \;

See also

Shell commands

Index