Case Sensitive Commands in Bash Shell
I can reproduce most of this behaviour with the ncal
variant of cal
installed:
ls -l /usr/bin/*cal
lrwxrwxrwx 1 root root 4 May 4 2018 /usr/bin/cal -> ncal
-rwxr-xr-x 1 root root 29848 May 4 2018 /usr/bin/ncal
The documentation can be found with man cal
(or man ncal
) and the interesting part is under the DESCRIPTION where it writes,
The
cal
utility displays a simple calendar in traditional format andncal
offers an alternative layout, more options and the date of Easter
Since cal
and ncal
are actually the same program, it follows that the application must check the name by which it's called to determine the output layout. Further investigation determines that a name starting with cal
is the exception, and calling the program by other names such as ncal
or CAL
produce the "new" output with days of the week running vertically downwards:
cal # or any word starting "cal" such as calendar
December 2021
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
ncal # or CAL
December 2021
Mo 6 13 20 27
Tu 7 14 21 28
We 1 8 15 22 29
Th 2 9 16 23 30
Fr 3 10 17 24 31
Sa 4 11 18 25
Su 5 12 19 26
Now, as to why you can't see CAL
. My guess is that you are using a case-insensitive filesystem (perhaps NTFS or vFAT). Such filesystems will find a match to an file regardless of the case, but will also prefer the case of the filename actually stored. Here, that's cal
. So although ls /usr/bin/CAL
or which CAL
will match and return an apparent match to /usr/bin/CAL
, as the file is actually called /usr/bin/cal
that's what the default ls /usr/bin
will list.