Common Linux commands (30)-cal
The cal command can be used to display calendars in the Gregorian calendar. The Gregorian calendar is an international calendar, also known as the Gregorian calendar. The "Gregorian Calendar", also known as the "solar calendar", is a year when the earth is traveling around the sun for a week. It is used by Western countries and is also known as the "Western calendar ".
1.Command Format:
Cal [parameter] [month] [year]
2.Command function:
Used to view time information such as calendar. If there is only one parameter, it indicates the year (1-9999). If there are two parameters, it indicates the month and the year.
3.Command parameters:
-1: displays the calendar of a month.
-3 displays the calendar of the previous month, current month, and next month of the system.
-S indicates that Sunday is the first day of a week. The default format is
-M: display Monday as the first day of a week.
-J indicates the day of the current year (the date of the year is calculated by day, and the number of days of the current month in the year is displayed by default from January 1, January 1)
-Y: displays the calendar of the current year.
4.Instance used:
Instance 1:Show current month calendar
Command: cal
[Root @ localhost ~] # Cal October 12, 1516 5 6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2223 17 18 19 20 21 2930 24 25 26 27 28 31 [root @ localhost ~] #
Example 2:Displays the calendar of a specified month.
Command: cal 9 2012
[Root @ localhost ~] # Cal 9 2012 November 12, 1516 5 6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2223 17 19 20 21 2930 24 25 26 27 28
Example 3:Show calendar month (2013)
Command:
Cal-y 2013
Cal 2013
2013 January February MarchSu 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 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 913 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 1620 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 2327 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30 31 April May JuneSu 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 1 7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 814 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 1521 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 2228 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 30 July August SeptemberSu 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 1 2 3 4 5 6 7 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 1414 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 2121 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 2828 29 30 31 25 26 27 28 29 30 31 29 30 October November DecemberSu 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 7 6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 1413 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 2120 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 2827 28 29 30 31 24 25 26 27 28 29 30 29 30 31
Example 4:Display the number of days from January 1, January 1
Command: cal-j
[Root @ localhost ~] # Cal-j August 12, December 20 five six 1234 336337 338 339 340 341 342 343344 345 346 347 348 349 350351 352 353 354 355 356 357358 359 360 361 362 363 364365 366 [root @ localhost ~] #
Example 5:Monday is shown in the first column
Command: cal-m
[Root @ localhost ~] # Cal-m October 12 October 5 th six days 1 2 3 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 22 2324 25 25 26 27 28 29 3031 [root @ localhost ~] #