How to create symbolic links

Occasionally you will need to make a link to a file or directory in Linux. To create a symbolic link you will need to use the ln command, which will follow the form of;

ln -s <target> <link name>

Example: Assume you frequently use gnome-calculator and decide you want a link on your desktop so you can quickly start that application in the future. To accomplish this with a symbolic link you could do the following;

ln -s /usr/bin/gnome-calculator ~/Desktop/calculator

You can also update an old symbolic link by overwriting the link using the following command.

ln -sf /usr/bin/gnome-calculator ~/Desktop/calculator

or when linking to directories you will need to include an n option

ln -sfn /mydir/ linkname

Advertisements

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