Learning about Linux: Symbolic Links and How to Create Them

Ln command

Hello, good day. Today we'll learn something basic about Linux: symbolic links . For those unfamiliar with the concept, symbolic links are the equivalent of shortcuts in Windows.

Symbolic links are more useful than shortcuts , since they can be used by programs to access or use the files that the symbolic links point to.

To start using symbolic links, we need to access a terminal . We open it by typing ctrl+alt+to alt+f2 and we will use the ln command to create our link.

The way to use it is as follows:

ln -s origen destino

You can check the options offered by the ln command with the help of –help:

[darkcrizt@Darkcrizt-Lap]$ ln --help

Modo de empleo: ln [OPCIÓN]... [-T] OBJETIVO NOMBRE_DEL_ENLACE (1ª forma)

o bien: ln [OPCIÓN]... OBJETIVO (2ª forma)

o bien: ln [OPCIÓN]... OBJETIVO... DIRECTORIO (3ª forma)

o bien: ln [OPCIÓN]... -t DIRECTORIO OBJETIVO... (4ª forma)

A practical example that I am going to use is to create the symbolic link for my download folder on my desktop. In this case we do it on folders

It would be as follows:

ln -s /home/darkcrizt/Descargas /home/darkcrizt/Escritorio/descargas

For example, if I have a script that I want to run, but I want to avoid having to navigate to the folder where I have it saved, we can also create a symbolic link of it.

The example is this:

ln -s /home/darkcrizt/scripts/actualizar.sh /home/darkcrizt/Escritorio/script.sh

Finally, in order to know the path of a link, we can execute the following command on the place where we have the link:

[darkcrizt@Darkcrizt-Lap Escritorio]$ ls -l

total 0

lrwxrwxrwx 1 darkcrizt darkcrizt 25 feb 25 21:00 descargas -> /home/darkcrizt/Descargas

lrwxrwxrwx 1 darkcrizt darkcrizt 37 feb 25 21:15 script.sh -> /home/darkcrizt/scripts/actualizar.sh

[darkcrizt@Darkcrizt-Lap Escritorio]$

That's all for now; just give this little utility a try. That 's all until next time.


Add as preferred source in Google