This section will discuss how to create links or short cuts to files and/or directories. Links are a handy way to create your own user-friendly name for a command. You can also use links to quickly get to a long path name. As a old unix user, I like to use the command pg instead of the Linux command less. By creating a link from ‘less’ to ‘pg’, everytime I enter ‘pg’, Linux actually uses the ‘less’ command.
ln creates standard or symbolic links.
Note: Make sure the name you are linking to do not already exist!
|Options||What it does|
|-s||Will create a symbolic link|
|directory or file name||name of existing path, directory or file name|
|directory or file name||new linked name|
|Examples||What it does|
|ln /usr/bin/less /usr/bin/pg||Links pg to less|
|ln -s /var/log /logs||Creates a symbolic link ‘/logs’ to the directory ‘/var/log’.
If you enter ‘cd /logs’, you are actually in the directory ‘/var/log’.