If you are tired of navigating files using long commands in the Linux system or are looking for a way to get to any directory or file without stating its path, then there is good news for you as you can create symbolic links for directories or files.
Generally, there are two types of links, one is hard link and the other one is soft link. The symbolic links come under the soft links as they do not create copies of files and directories. So, read this guide if you are not aware of creating and using symbolic links in Linux Mint.
Creating a Symbolic Link of a Directory in Linux Mint 21
The main significance of creating symbolic link in Linux is to make the access of files and directories easy as especially the ones that are daily used by the user, below syntax must be followed to create a symbolic link of any directory in Linux system:
For illustration there is an example that has been done by following the above syntax:
Now just to be sure that of the link is created check it by using the below given syntax:
Let’s check the link we created above using:
Now if one wants to access the respective directory just use the cd command along with the name of link created for that directory, below is the syntax for it:
For example, let’s access the directory whose link we created above using:
So, this is how one can easily access the directory easily using the symbolic links.
Creating a Symbolic Link of a File in Linux Mint 21
If you want to create a link for a file in Linux, then follow the below-given syntax that includes file path and its link name:
For instance, if the there is a text file that you use regularly then:
To check if the link is created correctly, use:
The main use of creating symbolic link for a file is that one can read or execute the file by just using the cat command along with the file name link:
Moreover, file can be edited as well using the nano command with the file link name:
Another way to see if the links are created is by using the ls command in the terminal as it will display the links:
Removing Symbolic Links in Linux Mint 21
If you want to remove the symbolic links in Linux, then there are two commands for it one is rm and the other is unlink. To demonstrate one command is used to remove the link created for the text file:
The other one is used to remove the link created for the directory:
Conclusion
Symbolic links are normally used to make the access to files or directories of Linux easy. These links can be termed as shortcuts of files and folders as that in the Windows operating system. The detailed process of creating and using symbolic links in Linux Mint 21 are mentioned in this write-up.