Many systems rely on symlinks essentially for handling default settings.
The relationship between a program name and the code that should run is not always biunivocal (a 1 to 1 relationship) :
a 1 to many : Because different implementations of whatever commonly used program can coexist on a system, and, users and historical scripts just do not need/want to care… and simply fire some common command name, administrators need to symlink :
Just think of the most basic sh
command. Just many shells exist bash, csh, ksh, zsh… pffff… and just many of the associated binaries can coexist on the system. Which one of these should be launched when simply asked for sh
?
On my system the arbitrary decision is as simple as :
616457 0 lrwxrwxrwx 1 root root 4 14 mai 2021 /bin/sh -> bash
Of course we immediately think of sh
but the same would happen with just many commonly used command names (awk, bzip2, bc, cpio, gzip, lex, tar, yacc…) On my system :
616450 0 lrwxrwxrwx 1 root root 15 8 juil. 2020 /bin/awk -> ../usr/bin/gawk
484973 0 lrwxrwxrwx 1 root root 10 8 juil. 2020 /usr/bin/yacc -> yacc.bison
484674 0 lrwxrwxrwx 1 root root 4 27 nov. 02:14 /usr/bin/lex -> flex
Of course, all this goes similarly when different versions of the same program coexist. Think principally of compilers, language interpreters, not to say running kernel's source code. On my system :
484470 0 lrwxrwxrwx 1 root root 43 26 nov. 23:43 /usr/bin/gcc -> /usr/x86_64-pc-linux-gnu/gcc-bin/10.4.0/gcc
485883 0 lrwxrwxrwx 1 root root 19 7 déc. 01:41 /usr/src/linux -> linux-5.4.225-0707a
a many to 1 : The other need to rely on symlinks is for very special filesystems such as /sys
where the information resides in one unique pseudo-file which is handy to access through several paths when searching for it.