How to show calendar in Debian terminal

We all know how useful the Calendar graphical application is on our Debian system. However, if you are more into terminals, you can use powerful command line utilities like cal and ncal to customize how you view calendars for a specific month or year.

In this article, we will explain how you can display standard and custom calendars in Debian Terminal. We have followed the commands and procedures mentioned in this article on a Debian 10 Buster system.

We will be using the Linux terminal to view custom calendars. You can open it by searching for Application Launcher as follows:

The application launcher can be accessed by pressing the Super / Windows key on your keyboard.

Using the cal command

The Linux cal utility displays the calendar in a traditional horizontal format. The following simple cal command is used to view the calendar for the current month with the current date highlighted:

$ cal

Debian cal team

Calibration command parameters

You can view the calendar according to the following syntax based on the options described below:

$ cal [-m [month]] [-y [year]] [-3] [-1] [-A [number]] [-B [number]] [-d [YYYY-MM]] [-j]

OptionUse
-m [month]Use this option to display the calendar for the specified month. You can specify the full month name, such as January, or a three-letter abbreviation, such as January. Alternatively, you can also specify the month number using this option. This switch also gives you the ability to view the calendar for the next month; in this case you can add the letter f after the month number like -m 1f
-y [year]Use this option to view the calendar for a specified year. For example, ‘-y 2019’ will display all months of 2019.
-1Use this option to view the calendar for only one month. Since this is the default setting, you may not use this switch unnecessarily.
-3Use this option to view three month calendars; they include the current month, the previous month, and the upcoming month.
-AND [number]Use this option if you want to view the number of upcoming X months along with the calendar you have already set up to view.

Example 1: cal -3 -A 1 (this command will display the calendar for the current, previous and next month, and also 1 more month after the next month)

Example 2: cal -y 2019 -A 1 (This command will display the calendar for 2019 along with another month, i.e. January 2020.

-B [number]Use this option if you want to view the X number of previous months along with the calendar that you have already set up to view.

Example 1: cal -3 -B 1 (this command will display the calendar for the current, previous and next month, as well as 1 more month before the previous month)

Example 2: cal -y 2019 -B 1 (This command will display the calendar for 2019 along with one month of the previous year, i.e. December 2018.

-d [YYYY-MM]You can view the calendar of a specific month for a specific year by specifying that year and month in YYYY-MM format with the -d option.
-jYou can use this option to view the calendar in Julian format instead of the default Gregorian format.

Cal command example

The following command will display the entire calendar for the current year:

$ cal -y

Command line calendar app

The following command will display the calendar for February 2018 as it appears in the YYYY-MM format in the command:

$ cal -d 2018-02

Show calendar dateAdvertisement

Using the ncal command

The ncal command is more powerful than the Linux cal command. It displays the calendar in a vertical format with some additional options. These include showing the Easter date, viewing the calendar with Monday or Sunday as start days, and more.

The following simple ncal command is used to view the calendar in a vertical format for the current month with the current date highlighted:

$ ncal

Debian ncal team

Ncal Command Options

You can view the calendar according to the following ncal syntax based on the options described below:

$ ncal [-m [month]] [-y [year]] [-h] [-3] [-1] [-A [number]] [-B [number]] [-d [YYYY-MM]] [-C] [-e] [-o] [-p] [-w] [-M] [-S] [-b]

Note. The options already described for the cal command can be used in the same way for the ncal command.

ParametersUse
-hourBy default, the cal command highlights today’s date. However, if you use the -h option, it will not highlight the date.
-eUse this option to view the Easter date in Western calendars.
-aboutUse this option to view the date of Orthodox Easter.
-PUse this option to view the country codes and switching days that are used to switch from the Julian to Gregorian calendar for that country.
-wWhen you use this option, ncal will print the week number below each week.
-CUsing this option, you can use all the options of the cal command with the ncal command.
-MUse this option to view calendars where Monday is the first day of the week.
-SUse this option to view calendars where Sunday is the first day of the week.
-bWhen you use this parameter, ncal will display the calendar horizontally as it is displayed with the cal command.

Ncal Command Examples

The following command will display the calendar for the current month without highlighting today’s date:

$ ncal -h

ncal -h command

The following command will display the current month calendar Monday as the first day of the week.

$ ncal -M

Ncal M

Through this article, you learned how to view calendars according to the many options available for the cal and ncal commands. Using these options, you can customize how calendars are viewed instead of the usual way Debian calendars are displayed.

How to show calendar in Debian terminal

Sidebar