How to Create a Symlink (shortcut) in Linux

This guide explains what a symlink is, why you might want to use them, and how to use them – in 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>

For more info on how to use symlinks in Linux be sure to check out the symlink man page. Now that you know how to create a symlink in Linux, why not read some other Linux tutorials, tips and tricks.

If this article helped you, I'd be grateful if you could share it on your preferred social network - it helps me a lot. If you're feeling particularly generous, you could buy me a coffee and I'd be super grateful :)

buy a coffee for

Home » Linux » How to Create a Symlink (shortcut) in Linux

1 thought on “How to Create a Symlink (shortcut) in Linux”

Leave a Comment

Your email address will not be published.