I am using Linux Mint 20.1, which is based on Ubuntu 20.04. My kernel is 5.4.0-60-generic
. All the commands below are runned in GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
I have seen the same behaviour with some other commands, but I'll use ping
as an example here. Let's see what happens if I run the following commands:
nikolay@KoLin:~$ ping4 -c1 google.com
PING google.com (108.177.14.139) 56(84) bytes of data.
64 bytes from lt-in-f139.1e100.net (108.177.14.139): icmp_seq=1 ttl=107 time=41.3 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 41.301/41.301/41.301/0.000 ms
nikolay@KoLin:~$ ping6 -c1 google.com
ping6: connect: Network is unreachable
nikolay@KoLin:~$
The output is reasonable. The error, obviously, occurs in the second run, because I don't have an IPv6 network configured on my laptop. But the output proves that ping4
and ping6
are two different things in my system. But what are they actually? They are both located in /usr/bin
:
nikolay@KoLin:~$ whereis ping{4,6}
ping4: /usr/bin/ping4 /usr/share/man/man8/ping4.8.gz
ping6: /usr/bin/ping6 /usr/share/man/man8/ping6.8.gz
nikolay@KoLin:~$
And what are these files actually?
nikolay@KoLin:~$ ls -l /usr/bin/ping*
-rwxr-xr-x 1 root root 72776 Jan 31 2020 /usr/bin/ping
lrwxrwxrwx 1 root root 4 Jan 11 21:00 /usr/bin/ping4 -> ping
lrwxrwxrwx 1 root root 4 Jan 11 21:00 /usr/bin/ping6 -> ping
nikolay@KoLin:~$
Wow! They are both symbolic links to the same executable /usr/bin/ping
! But how's that possible? Is there some magical way to make symbolic link add execution arguments?