Taking Your Calendar to the Command Line
Here's the latest in an irregular series of short posts that introduce a few Linux terminal tricks.
Where, on your computer, do you go to check a date? Probably the calendar on the toolbar of your desktop or in a calendar app or widget.
That's one way to do it. You can also check dates at the Linux command line. How? Using the cal command. There's nothing extra you need to install or configure, either — cal comes as standard kit with every distribution.
Let's take a quick look at the basics of using the cal command.
Open a terminal window, type cal, and press Enter. The calendar for this month displays.
You'll notice that today's date is also highlighted.
You can type cal -y to see each month for the current year (again, with today's date highlighted).
Depending on the size of the font you use in your terminal, you might have to scroll a bit to see everything.
To view a specific month in the current year, type cal -m [month] (replacing [month] with the name or number of the month). Let's say you want to view the calendar for December of this year. Type either cal -m 12 or cal december (the case doesn't matter).
Zooming in a Bit More
That's all well and good, but what if you want to view the calendar for a specific year? Do that by typing cal [year], where you replace [year] with a year. To view the calendar for 2032, type cal 2032.
You can also zoom in on a specific month in a specific year. To do that, type cal followed by the name or number of the month, followed by the year. So, to view the calendar for May, 2045, type cal 5 2045
There's is a bit more you can do with the cal command, which I'll look at in a future post in this space.