Linux / UNIX: displays a calendar and the date of easter with cal command

Q. date command displays date and time under a shell? How do I display calendar under Linux or UNIX?

ADVERTISEMENTS

A. date displays the Linux or UNIX system current date and time. The cal command displays a simple calendar in traditional format and ncal offers an alternative layout, more options and the date of easter. The new format is a little cramped but it makes a year fit on a 25×80 terminal. If arguments are not specified, the current month is displayed.

cal command

Just enter cal command as follows:
$ cal
Output:

    August 2007     
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 command

ncal command changes the output format:
$ ncal
Output:

    August 2007
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   

Print calendar for year 2008

$ cal 2008
Output:

                               2008                                

       January               February                 March        
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
       1  2  3  4  5                   1  2                      1
 6  7  8  9 10 11 12    3  4  5  6  7  8  9    2  3  4  5  6  7  8
13 14 15 16 17 18 19   10 11 12 13 14 15 16    9 10 11 12 13 14 15
20 21 22 23 24 25 26   17 18 19 20 21 22 23   16 17 18 19 20 21 22
27 28 29 30 31         24 25 26 27 28 29      23 24 25 26 27 28 29
                                              30 31
        April                   May                   June         
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
       1  2  3  4  5                1  2  3    1  2  3  4  5  6  7
 6  7  8  9 10 11 12    4  5  6  7  8  9 10    8  9 10 11 12 13 14
13 14 15 16 17 18 19   11 12 13 14 15 16 17   15 16 17 18 19 20 21
20 21 22 23 24 25 26   18 19 20 21 22 23 24   22 23 24 25 26 27 28
27 28 29 30            25 26 27 28 29 30 31   29 30

        July                  August                September      
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
       1  2  3  4  5                   1  2       1  2  3  4  5  6
 6  7  8  9 10 11 12    3  4  5  6  7  8  9    7  8  9 10 11 12 13
13 14 15 16 17 18 19   10 11 12 13 14 15 16   14 15 16 17 18 19 20
20 21 22 23 24 25 26   17 18 19 20 21 22 23   21 22 23 24 25 26 27
27 28 29 30 31         24 25 26 27 28 29 30   28 29 30
                       31
       October               November               December       
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                      1       1  2  3  4  5  6
 5  6  7  8  9 10 11    2  3  4  5  6  7  8    7  8  9 10 11 12 13
12 13 14 15 16 17 18    9 10 11 12 13 14 15   14 15 16 17 18 19 20
19 20 21 22 23 24 25   16 17 18 19 20 21 22   21 22 23 24 25 26 27
26 27 28 29 30 31      23 24 25 26 27 28 29   28 29 30 31
                       30

Print calendar for particular month and year

Use syntax as follows:
cal {month [1-12]} {year[1-9999]}
For example, display Jan-2007 calendar, enter:
$ cal 1 2007

Print the previous month

To print the previous month, the current month, and the next month all on one row, enter:
$ cal -3

Display Julian Calendar, if combined with the -e option, display date of easter according to the Julian Calendar.

$ cal -J

Display date of easter (for western churches)

$ cal -e

Print a calendar where Monday is the first day of the week, as opposed to Sunday.

$ cal -m

Display Julian days (days one-based, numbered from January 1).

$ cal -j

Display date of orthodox easter (Greek and Russian Orthodox Churches).

$ cal -o
Print the country codes and switching days from Julian to Gregorian Calendar as they are assumed by ncal. The country code as determined from the local environment is marked with an asterisk.
$ cal -p

Print the number of the week below each week column.

cal -w

Display a calendar for the current year.

$ cal -y

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
11 comments… add one
  • bob Dec 6, 2009 @ 18:49

    I dont see some of those flags in my version of cal, I am running Fedora 12 with cal from util-linux-ng 2.16

    Is it GNU gcal?

  • kiran Jan 19, 2012 @ 8:34

    how to display 3 different months in a year using cal in linux?

  • i am Mar 3, 2012 @ 13:36

    how to display the easater date for 100 years ??
    thanx

  • tom Apr 10, 2012 @ 11:58

    How to use cal -s
    to check when did Spain switched from the Julian to Gregorian. Can you list the detailed country codes for cal -s

  • vikram mundotia Oct 22, 2012 @ 19:36

    how to display to display two month together using cal commend in linux

    • Satya Prakash Jan 4, 2013 @ 6:47

      If it is prev, current and next months then you can use $cal -3

  • satish Jul 30, 2013 @ 8:42

    ncal -w 2013 output is different than the original week numbers. there is a shift of 1 week as per ncal -w 2013 as because week 1 of 2013 comes as week 53 .

  • shree Jul 26, 2015 @ 9:58

    How to display a calendar for month of march starting with monday as first day of week

  • jayesh Sep 9, 2015 @ 7:26

    how to write the command to display a calendar for a month of March starting with Monday as first day of the week.

  • VK Sep 2, 2017 @ 3:18

    Suppose I give “cal 2016”. How to view it page by page??

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.