How to create links to files or folders (Symlink) in Linux

How to create links to files or folders (Symlink) in Linux

Windows shortcuts are a nightmare for me. Almost any application you install puts one on your desktop by default. Personally, every time this happens I trash it, even before the installation is complete. I want my desktop clean, just leaving it with more icons while I'm doing a job. But not all shortcuts are bad, and in Linux there are symbolic links or symlink that I already like more.

For starters, these links are not spontaneously generated and it is not all filled with them. To continue, it can serve us for what you see in the capture: link all the contents of a media folder to the personal folder. In this way, software like VLC only has to look in the original folder to find the content and it will be almost 100% the same. And it is that VLC does not allow to add an extra path for the library; you have to make it show your Multimedia Library, something that is not the same and, at least right now, it is not available in VLC 4.0 beta.

How to create a Symlink

To create a Symlink, it is best to do it with the terminal. There are file managers that do it with a graphical interface, but that will only be good for us to create a link to each time. From the terminal we can drag the content of a whole folder. The command would be the following:

ln -s "/ruta/de/origen" "/ruta/de/destino"

The good thing is that terminal allows us to drag folders within. An example to create the Symlink to a folder would be ln -s '/ media / pablinux / Data / Music / All That Remains' / home / pablinux / Music, the first having the quotes because I have dragged it. The command I have used to put the whole music folder is "a little" longer:

Link entire music folder

To select all the contents of a window, the most common in Linux is press Ctrl + A, but it is possible that some file manager uses the combination Ctrl + E. Once everything is selected, we drag it to the terminal, indicate the destination path and press Enter.

Other uses

This can help us too to "put" some files in the / bin folder, more specifically some that we will use with the terminal. For example, we can install several options of youtube-dl, but only the one offered in the official website and that of your GitHub. Right after the one we installed is updated with the command pip, but to use it we have to install the package python3-pip and the command to update the packages is a bit longer. In these cases I prefer to download the original file. Updating if we choose this option is as simple as writing youtube-dl -U, easy to remember at the moment let's see that it works erratically.

Creating a Symlink in / bin we will get the terminal to launch it wherever it is. Otherwise, we will not be able to launch it and we will have to drag the file to the terminal before the link to download. This, dragging it to the terminal, is something that we will have to do if we want to update it, since once we put it in the / bin folder it gives us an error. I want to emphasize that putting executables in the / bin folder can be dangerous and is only recommended if you trust the developer 100% .

Speed, your possible Achilles heel

But not everything is perfect. There may be a couple of problems depending on the origin of the link. If we are linking to the HDD part of a hybrid disc, no real difference is noticeable. Now, some Linux operating systems do not mount this part automatically, and that is something that we have to configure from the settings. The problems are accentuated if the disk is external or one wireless. First, in some cases you have to mount it manually, and second, you will notice that it loads the files. It can be 2-3 seconds a movie, but it is something to be mentioned.

Whatever and wherever the original file is, direct links or, in this case, Symlink can be very useful and, bearing in mind that they do not occupy anythingThey are worth it.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.