Cal command of Linux

Introductory notes 2022-06-24 06:13:28 阅读数:642

calcommandlinux

cal Commands can be used to display the Gregorian calendar ( The solar calendar ) The calendar . The Gregorian calendar is the current international calendar , It's also called the Gregorian calendar , It is commonly known as the solar calendar .“ The solar calendar ” also called “ Solar calendar ”, The earth's circle around the sun is a year , It is commonly used in western countries , So it's also called “ Western calendar ”.

Command format

cal [ Parameters ][ month ][ year ]

Command function

Used to view time information such as calendar , If there is only one parameter , It means the year (1-9999), If there are two parameters , It means month and year

Command parameter

  • -1 Show a month's calendar
  • -3 One month before the display system , The current month , Next month's calendar
  • -s Show Sunday as the first day of the week , Default format
  • -m Show Monday as the first day of the week
  • -j On the day of the year ( The date of the year is calculated by day , from 1 month 1 Starting from the number , By default, the number of days of the current month in a year is displayed )
  • -y Show calendar for current year

Show current month calendar

> cal
March 2021
Japan One Two 3、 ... and Four 5、 ... and 6、 ... and
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 

Displays the calendar for the specified month

> cal 9 2011
September 2011
Japan One Two 3、 ... and Four 5、 ... and 6、 ... and
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 

Show 2011 The calendar of the year

> cal -y 2011
2011
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 1 2 3 4 5 1 2 3 4 5
2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12
9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19
16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26
23 24 25 26 27 28 29 27 28 27 28 29 30 31
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 1 2 3 4 5 6 7 1 2 3 4
3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11
10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18
17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25
24 25 26 27 28 29 30 29 30 31 26 27 28 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 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24
24 25 26 27 28 29 30 28 29 30 31 25 26 27 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 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
30 31

Show from 1 month 1 Days of the day

> cal -j
March 2021
Japan One Two 3、 ... and Four 5、 ... and 6、 ... and
60 61 62 63 64 65
66 67 68 69 70 71 72
73 74 75 76 77 78 79
80 81 82 83 84 85 86
87 88 89 90 

Monday is displayed in the first column

> cal -m
March 2021
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

Displays the calendar of the previous month and the following month of the current month

> cal -3
February 2021 March 2021 April 2021
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 6 1 2 3 4 5 6 1 2 3
7 8 9 10 11 12 13 7 8 9 10 11 12 13 4 5 6 7 8 9 10
14 15 16 17 18 19 20 14 15 16 17 18 19 20 11 12 13 14 15 16 17
21 22 23 24 25 26 27 21 22 23 24 25 26 27 18 19 20 21 22 23 24
28 28 29 30 31 25 26 27 28 29 30

Link to the original text :https://rumenz.com/rumenbiji/linux-cal.html

WeChat official account : Entry station

copyright:author[Introductory notes],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/20210724115549154K.html