Symlinks - ln

ln is like making a shortcut to a file/application

Create a link to the specified file with optional link naming. If the link name is omitted, a link with the same name as the original file is created in the current directory.

When using the second form with more than one target file, the last argument must be a directory. Create hard links by default, symbolic links with –symbolic/ -s. When creating hard links, each file must exist.

--backup[=CONTROL]
make a backup of each existing destination file
-b
like --backup but does not accept an argument
-d, -F, --directory
hard link directories (super-user only)
-f, --force
remove existing destination files
-n, --no-dereference
treat destination that is a symlink to a directory as if it were a normal file
-i, --interactive
prompt whether to remove destinations
-s, --symbolic
make symbolic links instead of hard links
-S, --suffix=SUFFIX
override the usual backup suffix
--target-directory=DIRECTORY
specify the DIRECTORY in which to create the links
-v, --verbose
print name of each file before linking
--help
display this help and exit
--version
output version information and exit

To create a Symbolic link (Shortcut): If you leave the directory open with no filename in the second argument, it will name the symbolic link as the original file is named.

ln -s /path/to/original/file.txt path/to/new/file/directory/

This will name the new symbolic link as a different name

ln -s /path/to/original/file.txt path/to/new/file/directory/file2.txt

This will create a symbolic link of a file outside current directory in the current directory and by the same name as the original file

cd /to/some/directory/
ln -s /path/to/original/file.txt 
 
linux_administration/common_linux_commands/symlink.txt · Last modified: 2007/09/14 15:23 by vincenzobar
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki