The cal command in Linux and other Unix-like systems like FreeBSD is used to display a calendar of the current month or a specific month and year. The cal command is a simple tool that can be used to quickly view the calendar for the current month or any other month and year. This can be useful for checking the dates or simply for reference.
The basic syntax for cal is:
cal [options] [month] [year]
Where month and year are the month and year for which you want to display the calendar. If no month and year are specified, the current month and year will be used.
Examples:
To display the calendar of the current month:
cal
To display the calendar of a specific month and year:
cal 5 2023
output
$ cal January 2023 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 $ cal 5 2023 cal 5 2023 May 2023 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
The cal command also supports a variety of options that allow you to customize its behavior. For more detailed information, please refer to the manual pages for cal by running the command man cal
In summary, the cal command is a simple yet powerful tool that allows you to display a calendar of the current month or a specific month and year. By understanding the basic syntax and options, you can easily view the calendar for the current month or any other month and year.