View a calendar at the command prompt

You've probably already realized that clicking the time display at the top-right of the screen shows a calendar. To see the same kind of thing at the command-line, type cal. Without any command arguments, it will show the dates for the current month. If you want the axis of the calendar reversed (days down the side, rater than across the top), type ncal instead. To see the dates for last month, this month, and next month, type cal -3 (for some reason, however, this particular command-option doesn't work with ncal).

To see a calendar for a whole year, type the year straight afterward: cal 2010. To see a calendar for December of any particular year, type cal dec followed by the year (or you could type jan, feb, mar and so on).

Both cal and ncal can be used to find out historical dates. To find out the day when the Declaration of Independence was signed, type cal july 1776. If you seriously need to know precise dates going back millennia there might be issues with the Julian/Gregorian calendar switchover— see cal's man page for details.

Was this article helpful?

0 0

Post a comment