AlmaLinuxCentOSDebianLinuxLinux MintManjaroTutorialsUbuntu

How To Create Symbolic Links on Linux

Create Symbolic Links on Linux

In this tutorial, we will show you how to create Symbolic Links on Linux. For those of you who didn’t know, A symbolic link, also known as a symlink or soft link is a type of file in Linux that points to another file or a folder on your computer. Symlinks are similar to shortcuts in Windows. By using symbolic links, you make it possible to more easily access other files that might reside in complicated directory paths or are required for certain services.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step create Symbolic Links with practice examples.


  • A server running one of the following operating systems: Ubuntu or CentOS.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Create Symbolic Links on Linux

  • Command to Create Symbolic Links.

ln is a command-line utility for creating links between files. By default, the ln command creates hard links. To create a symbolic link, use the -s (--symbolic) option.

ln [-sf] [source] [destination]

For example, create a symbolic link with:

ln -s my_test_file.txt my_link_file.txt

To verify that the symlink was successfully created, use the ls command:

ls -l my_link_file.txt
  • Create a Symbolic Link to Linux Directory.

To create a symbolic link to a directory in Linux:

ln -s /mnt/external_drive/stock_movies ~/stock_movies

The above example creates a symbolic link named stock_movies on the home (~/) directory. The link refers to the stock_movies directory on an external_drive.

  • Unlink to Remove a Symlink.

You can remove existing links attached to files or directories by the unlink or rm command:

rm my_link_file.txt
unlink my_link_file.txt

Congratulations! You have successfully learned to create Symbolic Links. Thanks for using this tutorial to cover how to use the ln command to create symbolic links on your Linux system.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
Back to top button