cal
is a nice utility that displays calendar in terminal, but there is a small problem that needs to be fixed as it uses Sunday as the start of the week.
cal
is a link to ncal
utility.
$ ls -l $(which cal) lrwxrwxrwx 1 root root 4 Jun 11 2012 /usr/bin/cal -> ncal
It is a part of the bsdmainutils
package.
$ dpkg-query -S ncal bsdmainutils: /usr/share/man/man1/ncal.1.gz bsdmainutils: /usr/bin/ncal bash-completion: /usr/share/bash-completion/completions/ncal
It uses Sunday as the start of the week.
$ cal April 2018 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
cal
does not support -M
flag to use Monday as the start of the week, but ncal
does support it.
$ cal -M Usage: cal [general options] [-hjy] [[month] year] cal [general options] [-hj] [-m month] [year] ncal [general options] [-bhJjpwySM] [-s country_code] [[month] year] ncal [general options] [-bhJeoSM] [year] General options: [-NC31] [-A months] [-B months] For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]
$ ncal -M April 2018 Mo 2 9 16 23 30 Tu 3 10 17 24 We 4 11 18 25 Th 5 12 19 26 Fr 6 13 20 27 Sa 7 14 21 28 Su 1 8 15 22 29
You can use the old-style ncal
output to display calendar with Monday as the start of the week.
$ ncal -M -b April 2018 Mo Tu We Th Fr Sa Su 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
Create an alias to solve this problem permanently.
$ echo 'alias cal="ncal -M -b"' | tee -a ~/.bashrc alias cal="ncal -M -b"
$ source ~/.bashrc
$ cal April 2018 Mo Tu We Th Fr Sa Su 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
$ cal 08 2019 August 2019 Mo Tu We Th Fr Sa Su 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