GNU/Linux Command – LN

ln — Make LiNks between files.

Summary :
Create a link to the specified TARGET with optional LINK_NAME. If LINK_NAME is omitted, a link with the same basename as the TARGET is created in the current directory. By default, it makes HardLinks. A Hard link is another name for an existing file. The link and the original are indistinguishable. They share the same inode.

A Soft/Symbolic/Sym link is a special file type. The link file actually refers to a different file, by name. At runtime kernel automatically “dereferences” the link and operates on the target of the link.

Example:
$ ln --help -- Show help info.  $ ln A B -- Creates hard link B for file A.  $ ln -b A B -- Same as above. If B is already exist then ittakes a backup (B~) and creates new B.  $ ln -b -S .bak A B -- Same as above. If B is already exist thenit takes a backup with specified extension name (B.bak) andcreates new B. $ ln -f A B -- Force. If B is exist then overwrite it.  $ ln -i A B -- Interactive. Prompt the user for removing the already existing file B.  $ ln -s A B -- Creates soft link B for file A.  $ ln -s dir1/myfile -- Creates link ./myfile pointing dir1/myfile.  $ ln -s dir1/myfile myfile -- Creates link ./myname pointing todir1/myfile.  $ ln -s a b .. -- Creates links ../a and ../b pointing ./a and ./b
Read: man ln

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: