Connect with us

Development

Symbolic Link: A beginners guide

Here’s a helpful guide that should get you on your way.

woman programming on a laptop
Image: Pexels

Symbolic links are available within all operating systems and are considered to be quite handy features. However, most users have no idea what these features are meant for, and many don’t even know about the existence of this feature.

If you have never heard of it, this is a big omission, but we’ve got you covered! In fact, understanding the idea of symbolic links isn’t hard, and, in this article, we are going to guide you through this matter.

What Are Symbolic Links?

We are not going to confuse you with complex terms. Instead, let’s try to look at this matter from a simple perspective – think of soft links as of handy shortcuts. They are not completely the same, but the idea of both is to take a user to the files he is looking for faster and easier.

What makes it different from shortcut files? A symbolic link looks like an actual file although it isn’t. Users are taken to the needed file’s location as soon as they click on the link. Thus, in brief, these links are meant to help you navigate through the system easier and find file’s directories faster.

When Are These Links Helpful?

So, you have survived all these years without using soft links, so you might think that you don’t need them. However, there is much more to symbolic links that users may think. They are always used to extend the functionality of different services. In addition, using these links is a convenient and simple way to have faster access to your primary files and folders. There are many other uses of this feature or, better say, its handiness is almost unlimited!

Tips For Using Soft Links On Linux

Hopefully, our definition was clear enough to help you understand the idea of these links. Now, let’s look at some of the best ways to use these links on Linux.

First of all, let’s consider some of the most effective uses you can make of this feature. With the help of soft links, you can easily create links between directories and overcome the boundaries of the file system.

Now, let’s look at the main commands that will come in handy!

Creating a new link:

ln -s source_file my_link

ln -s /path/to/file1.txt /path/to/file2.txt

ls -s /etc/hosts /tmp/file

ls -ali /tmp/file /etc/hosts

Making a new directory:

In order to help you figure this step out, we will provide an example. Let’s say, the name of you directory is “foo”, to create it use the following command

$ mkdir foo

$ cd foo

To copy /etc/resolv.conf file use this command:

$ cp /etc/resolv.conf .

To view inode number use this command:

$ ls -ali

To create a soft link to resolv.conf use this command:

$ ln -s resolv.conf alink.conf

$ ls -ali

Deleting a link

Now how to remove symbolic link Linux? For this purpose, use this command:

rm /path/to/your/symbolic/link

Have any thoughts on this? Let us know down below in the comments or carry the discussion over to our Twitter or Facebook.

Editors’ Recommendations:

Just another guy who likes to write about tech and gadgets.

Comments
Advertisement

More in Development