Skip to content


How to create a symlink (shortcut) in Linux

Linux

Symlinks or symbolic links are the Linux equivalent of shortcuts in Windows. Creating symlinks of files or folders can be quite useful in Linux, as you can shorten a path such as /var/www/html/application/configuration/images/config.php to something easier to remember and manage such as /var/www/html/image-config.php. Let’s see how this can be done.

Use the following command to create such a symlink:

# ln -s /var/www/html/application/configuration/images/config.php /var/www/html/image-config.php

What we have done here is that we have created a symbolic link, /var/www/html/image-config.php, to /var/www/html/application/configuration/images/config.php. You can verify if the symlink was created correctly by running the following command:

# ls -all /var/www/html/image-config.php
lrwxrwxrwx 1 calvin calvin 37 Apr 29 16:41 image-config.php -> /var/www/html/application/configuration/images/config.php

If you are administering a Linux server symlinks can make your life a lot easer and it is something you should definitely familiarize yourself with. The easy way to remember the symlink syntax is:

# ln -s <source> <destination link>

Posted in Linux.

Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

 

You can always opt out of this email subscription at any time.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.