Home > Software design >  command line calendar with Monday as the first day of the week
command line calendar with Monday as the first day of the week

Time:05-15

I'm trying to figure out how to use cal command on Linux/Debian to display Monday as the first day of the week instead of Sunday.

From what I see accordingly to cal's man page

-M      Weeks start on Monday.

But it doesn't seem to work on my machine:

cal -M
Usage: cal [general options] [-jy] [[month] year]
       cal [general options] [-j] [-m month] [year]
       ncal -C [general options] [-jy] [[month] year]
       ncal -C [general options] [-j] [-m month] [year]
       ncal [general options] [-bhJjpwySM] [-H yyyy-mm-dd] [-s country_code] [-W number of days] [[month] year]
       ncal [general options] [-Jeo] [year]
General options: [-31] [-A months] [-B months] [-d yyyy-mm]

CodePudding user response:

cal doesn't support -M option in all UNIX versions.

Alternatively, you can use ncal -M -b to get the desired output.

      May 2022        
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                 

Credits:

How to display calendar in terminal with Monday as the start of the week

Unix - Monday as first day

  • Related