Command line Calendar utilities on Debian

Linux distributions provides simple and useful utilities through command line. Calendar in GNU/Linux might seem like novelty, however mastering the tool may be helpful. In this article, we would discuss command line Calendar utilities on Debian distribution.

There are many command line interface (CLI) utilities for calendar available.

First CLI utility is cal command, available in most distributions. cal command displays current month by default and highlights the present day by default.

Note: Following operations would require you to have super user privileges. In case you don’t have one, then contact your System Administrator for assistance.

bsdmainutils package contains the utility cal. Therefore, we can install the relevant package through –

su-l
apt-get install bsdmainutils

Logout from root/superuser. And, issue the following in terminal –

$ cal

cal-command

The cal command returns present month calendar with highlighted day as the output.

Moreover, there is a command ncal, which is included in the bsdmainutils package as well but offers an alternative layout.

$ ncal

ncal-command

What is the difference between cal and ncal ?

While cal presents a week horizontally and ncal display a week in calendar as vertical. cal command was present in AT&T UNIX and ncal was used in FreeBSD. To keep compatibility with older Unix’s cal command, it would output 8 lines, as cal command was used in many CGI scripts.

Now, lets see some examples :

To Print for particular month and year
cal (month) (year)

$ cal 6 2019

Print the previous, current and next month surrounding today

$ cal -3

And, print for a specific month
cal -m (month)

$ cal -m 2

Remember:

An unnoticed behaviour by user may lead to altering result in cal command, how?

In case, if you were to display a calendar of month June of 2018, you may enter

cal 6 2019

cal-command

which is correct, however if you type –

cal 6 19

cal-command-1

it will display June from year 19 AD, so remember to READ THE MANUAL.

Try cal 9 1752, Skipped 11 Days in calendar?

cal-9-1972

yes, that is due to Gregorian Reformation.

Now, try different utility – gcal

It can be installed through –

apt-get install gcal

gcal is GNU utility, it can calculate astronomical data, displays eternal holiday lists for countries around the world, fixed date lists for reminders and much more.

To print current month of year

gcal

Print previous, current and next month surrounding today

gcal .

And, print month of year

gcal (month) (year)

gcal 6 2019

In conclusion, we have discussed various command line Calendar utilities on Debian.