Get a Calendar from Command Line for Any Date, Month, Year
Though just about everyone has our phones glued to us with a dedicated calendar app, for users who spend considerable time in the command line it can be more efficient to stay put rather than stray to another app or pick up a different device to flip around in the calendar and find a given date. With the help of a simple command line calendar utility, you can generate a calendar instantly, which is great for quick reference for dates and occasions. Going further, you can even generate a calendar for any date, in any year, and for any month, whether it’s the current year and month, last year, sometime in the Roman empire, or deep in the distant future of House Atreides.
This is a simple command that works with Mac OS X and Linux, so even if you’re not too comfortable with the command line you can still follow along. On the Mac, open the Terminal application from /Applications/Utilities/ to get started.
Generating a Calendar from the Command Line for Any Date
At it’s most simple form, you can print a calendar of the current month by typing:
This generates a calendar of the current month in the current year, showing which dates fall on which days. Nice and useful.
To get a calendar generated for a specific month in a specific year, use the following command syntax, replacing the numbers as appropriate for the given month and desired year:
cal 5 2018
You can go as far into the past or the future as you want, generating an accurate calendar for any month and any year. Feel like time traveling? Just put the date into the Calendar, it’s easy:
For the time travelers, the calendar limits at the year 9999, so if you’re hoping to go beyond that you may have an issue. Likewise, the calendar year begins at year 1, like most Gregorian calendars do, so you may not have much success trying to visit the dinosaurs with this utility.
You can also generate calendars in a nice easy to read ASCII format for an entire year, printing the months onto a grid that is scannable like so:
Simple to generate, easy to read, and you don’t even need to refer to the Calendar app on the Mac or iPhone, it’s all right here in the Terminal.