Skip to main content
  1. Posts/

Softlinks in linux

·1 min

Softlinks in linux #

Softlinks are basically an absolute path to the executable, like in windows we see desktop shortcuts which actually leads to an absolute path of the executable resulting in executing that file upon clicking.

$ ln -s path_to_target_file path_to_link_file

path_to_target_file -> original file
path_to_link_file -> represents shortcut

$ ls -l

Output:

$ lrwxrwxrwx root root     23 B  Sun Jul 17 00:48:34 2022  vtrgb β‡’ /etc/alternatives/vtrgb

Shows an example of a file in that directory.

$ readlink family_dog_shortcut.jpg

Output:

$ /home/aaron/Pictures/family_dog.jpg

Shows hard and softlinks of mentioned file.

Softlinks can be made between file to file or dir to dir or even between different filesystems.