Detailed explanation of linux commands-cal commands (display calendar)

Source: Internet
Author: User
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 around the Earth for the Sun. it is used by Western countries"

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 functions:
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. example:
Instance 1: displays the calendar of the current month.
Command: cal
Output:

Copy codeThe code is as follows:
[Root @ localhost ~] # Cal
December 20
October 6, 1234
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
[Root @ localhost ~] #

Instance 2: displays the calendar of the specified month
Command: cal 9 2012
Output:

Copy codeThe code is as follows:
[Root @ localhost ~] # Cal 9 2012
September 20
October 6, 1234
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

Instance 3: displays the calendar month, 2013
Command:

Copy codeThe code is as follows:
Cal-y 2013
Cal 2013

Output:
Instance 4: displays the number of days since January 1, January 1.
Command: cal-j
Output:

Copy codeThe code is as follows:
[Root @ localhost ~] # Cal-j
December 20
October 6, 1234
336
337 338 339 340 341 342 343
344 345 346 347 348 349 350
351 352 353 354 355 356 357
358 359 360 361 362 363 364
365 366
[Root @ localhost ~] #

Instance 5: display on Monday in the first column
Command: cal-m
Output:

Copy codeThe code is as follows:
[Root @ localhost ~] # Cal-m
December 20
September 6, 1234
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 [root @ localhost ~] #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.