Softlinks in linux
·1 min
Table of Contents
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.
Creating softlinks #
$ ln -s path_to_target_file path_to_link_file
path_to_target_file -> original file
path_to_link_file -> represents shortcut
Viewing hard/softlinks #
$ 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.
Reading hard/softlinks of a file #
$ readlink family_dog_shortcut.jpg
Output:
$ /home/aaron/Pictures/family_dog.jpg
Shows hard and softlinks of mentioned file.
Important points of softlinks #
Softlinks can be made between file to file or dir to dir or even between different filesystems.