This article introduces the MAC terminal display calendar Information command, provides a number of examples to illustrate the use of these two commands and the application of each parameter scenarios.
Mac system built-in commands for displaying calendars are CALs and ncal, which make it easy to view calendar information directly on the terminal, such as when some servers do not have a graphical interface installed, and can view the calendar at the command line.
Some of the parameters are used differently from Linux, but most are generic.
command format:
usage:cal [-JY] [[month] year]
cal [-j] [M month] [year]
ncal [-jjpwy] [s country_code] [[month] year]
ncal [-jeo] [Year]
Example:
1. Show Month calendar
Cal
2. Show Month calendar is the day ordinal of the current year
Cal-j
3. Display the current year calendar
Cal-y
4. Display the calendar for the specified month
Cal 1 2019
5. Vertical arrangement of calendars
Ncal
6. Show this week is the first few weeks
Ncal-w
7. Show Country Code
Ncal-p