Linux cal Command
last modified October 23, 2026
The cal command in Linux displays a calendar in the terminal.
It shows a single month, several months, or a whole year, and can also
display day-of-year numbers. Its companion ncal prints the
calendar vertically and adds features such as week numbers and the date of
Easter.
Two different implementations are in use. Debian, Ubuntu, and their
derivatives ship the BSD cal and ncal from the
ncal package, which this article uses. Fedora, Arch, and other
distributions ship cal from util-linux; the basic usage is the
same, but some options differ, as noted below. When run in a terminal,
cal highlights the current day.
Current month
Without arguments, cal shows the current month.
cal
The calendar starts with Sunday by default. Today's date is shown in reverse video when the output goes to a terminal.
$ cal
October 2026
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
A specific month
A month and a year select a particular month. The month can be a number or a name.
cal 2 2028 cal mar 2026
February 2028 has 29 days, since 2028 is a leap year. The year must be given
in full: cal 2 28 would show February of the year 28.
$ cal 2 2028
February 2028
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
$ cal mar 2026
March 2026
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
A whole year
A single number is interpreted as a year.
cal 2027
The twelve months are printed in a grid of three columns. The
-y option shows the current year.
$ cal 2027
2027
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 1 2 3 4 5 6 1 2 3 4 5 6
3 4 5 6 7 8 9 7 8 9 10 11 12 13 7 8 9 10 11 12 13
10 11 12 13 14 15 16 14 15 16 17 18 19 20 14 15 16 17 18 19 20
17 18 19 20 21 22 23 21 22 23 24 25 26 27 21 22 23 24 25 26 27
24 25 26 27 28 29 30 28 28 29 30 31
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 1 1 2 3 4 5
4 5 6 7 8 9 10 2 3 4 5 6 7 8 6 7 8 9 10 11 12
11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19
18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26
25 26 27 28 29 30 23 24 25 26 27 28 29 27 28 29 30
30 31
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 1 2 3 4 5 6 7 1 2 3 4
4 5 6 7 8 9 10 8 9 10 11 12 13 14 5 6 7 8 9 10 11
11 12 13 14 15 16 17 15 16 17 18 19 20 21 12 13 14 15 16 17 18
18 19 20 21 22 23 24 22 23 24 25 26 27 28 19 20 21 22 23 24 25
25 26 27 28 29 30 31 29 30 31 26 27 28 29 30
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 1 2 3 4 5 6 1 2 3 4
3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
31
Several months
The -3 option shows the previous, current, and next month. The
-A and -B options add months after and before the
selected one.
cal -3 cal -A 2 -B 0 12 2026
The second command shows December 2026 and the two following months, which is
handy for planning across the turn of the year. In util-linux
cal, the same is done with -n 3 to show three
months.
$ cal -3
September 2026 October 2026 November 2026
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
$ cal -A 2 -B 0 12 2026
December 2026 January 2027 February 2027
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
31
A month of the current year
In the BSD cal, the -m option selects a month of
the current year.
cal -m 7
The command shows July of the current year. Be careful: in util-linux
cal, -m means something else, namely that weeks
start on Monday.
$ cal -m 7
July 2026
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
Day-of-year numbers
The -j option numbers the days from the beginning of the year
instead of the beginning of the month.
cal -j 2 2026
February 1 is day 32 of the year. These numbers are often called Julian
days, although that term properly refers to a different astronomical count.
They are the same values that date +%j prints.
$ cal -j 2 2026
February 2026
Su Mo Tu We Th Fr Sa
32 33 34 35 36 37 38
39 40 41 42 43 44 45
46 47 48 49 50 51 52
53 54 55 56 57 58 59
Vertical layout, week numbers, and Monday start
ncal prints the weekdays as rows. It offers options that the BSD
cal lacks.
ncal 11 2026 ncal -w 11 2026 ncal -bM 11 2026
The -w option prints ISO week numbers below the columns. The
-b option switches back to the familiar horizontal layout, and
-M starts weeks on Monday, as is common in Europe. In
util-linux, these are cal -w and cal -m.
$ ncal 11 2026
November 2026
Su 1 8 15 22 29
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
$ ncal -w 11 2026
November 2026
Su 1 8 15 22 29
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
45 46 47 48 49
$ ncal -bM 11 2026
November 2026
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
Easter dates
The -e and -o options of ncal print
the date of Western and Orthodox Easter.
ncal -e 2026 ncal -o 2026
In 2026, Western Easter falls on April 5 and Orthodox Easter on April 12. The date format follows the locale, here month/day/year.
$ ncal -e 2026 04/05/2026 $ ncal -o 2026 04/12/2026
The calendar reform of 1752
cal follows the historical switch from the Julian to the
Gregorian calendar, which took place in Britain and its colonies in
September 1752.
cal 9 1752
Eleven days were dropped: September 2 was followed by September 14. Other
countries switched at different times; ncal -s selects the
reform date of a given country code.
$ cal 9 1752
September 1752
Su Mo Tu We Th Fr Sa
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
cal in scripts
The output of cal can be processed to compute properties of a
month.
cal 2 2028 | awk 'NF {d = $NF} END {print d}'
The awk program remembers the last field of each non-empty line,
so at the end it holds the last day of the month. In a loop, we find the
length of February in several years. For general date arithmetic,
the date command is more suitable, for
example date -d "2028-03-01 -1 day" +%d.
$ cal 2 2028 | awk 'NF {d = $NF} END {print d}'
29
$ for y in 2026 2027 2028; do echo "$y: $(cal 2 $y | awk 'NF {d = $NF} END {print d}') days in February"; done
2026: 28 days in February
2027: 28 days in February
2028: 29 days in February
Best practices for cal
- Use full years: Write
2026, not26. - Know your implementation: Options such as
-mdiffer between BSD and util-linuxcal; checkman cal. - Use ncal for extras: Week numbers, Monday start, and
Easter dates are available in
ncal. - Use date for arithmetic: Parse dates with
daterather than the text output ofcal.
Source
In this article, we have used the cal and ncal
commands to display months and years, show day-of-year numbers, week numbers,
and Easter dates, and process calendars in scripts.
Author
List all Linux tutorials.