GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing zetcode.com — Linux cal Command - Display Calendar Linux cal Commandlast modified October 23, 2026
The
Two different implementations are in use. Debian, Ubuntu, and their
derivatives ship the BSD Current month
Without arguments, 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 monthA 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 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 yearA single number is interpreted as a year. cal 2027
The twelve months are printed in a grid of three columns. The
$ 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 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 -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 -m 7
The command shows July of the current year. Be careful: in util-linux
$ 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 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 $ 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 11 2026 ncal -w 11 2026 ncal -bM 11 2026
The $ 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 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 9 1752
Eleven days were dropped: September 2 was followed by September 14. Other
countries switched at different times; $ 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 2 2028 | awk 'NF {d = $NF} END {print d}'
The $ 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
Source
In this article, we have used the AuthorMy name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming. List all Linux tutorials. |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |