Linux cal and ncal command

Updated: 12/29/2017 by Computer Hope

About cal

The cal command displays a simple, formatted calendar in your terminal.

About ncal

In addition to cal, the ncal command ("new cal") is installed on some Linux systems. It provides the same functions of cal, but it can display the calendar vertically (with weeks in columns), and offers some additional options. On systems with ncal installed, cal is typically a symbolic link to ncal. It behaves like the original cal if you use the name cal to run the program.

Description

If no options are specified, cal and ncal display the current month in your terminal, with the current day highlighted.

The ncal command accepts a few additional options, described below.

Note: The cal and ncal command exist in many different forms on various Linux systems. You can check your version by running man cal.

Syntax

cal [month] [year] [-m month] [-y year] [-h] [-3] [-1] [-A num] [-B num]
    [-d YYYY-MM] [-j] [-N]
ncal [month] [year] [-m month] [-y year] [-h] [-3] [-1] [-A num] [-B num]
     [-d YYYY-MM] [-J] [-C] [-e] [-o] [-p] [-w] [-M] [-S] [-b]

Options

The following options are available in both cal and ncal:

Option Description
-h Don't highlight today's date.
-m month Specify a month to display. The month specifier can be a full month name (e.g., Februiary), a month abbreviation of at least three letters (e.g., Feb), or a number (e.g., 2). If you specify a number, followed by the letter f or p, the month of the following or previous year, respectively, will be displayed. For instance, -m 2f will display February of next year.
-y year Specify a year to display. For example, -y 1970 will display the entire calendar of the year 1970.
-3 Display last month, this month, and next month.
-1 Display only this month. This is the default.
-A num Display num months occurring after any months already specified. For example, -3 -A 3 will display last month, this month, and four months after this one; and -y 1970 -A 2 will display every month in 1970, and the first two months of 1971.
-B num Display num months occurring before any months already specified. For example, -3 -B 2 will display the previous three months, this month, and next month.
-d YYYY-MM Operate as if the current month is number MM of year YYYY.

Options: cal

The following options are available only in cal:

Option Description
-j Display a Julian calendar, instead of the default Gregorian calendar. All days are numbered from January 1, rather than from the beginning of the month.
-N Behave as if you ran ncal, using its options and display output.

Options: ncal

The following options are available only in ncal:

Option Description
-J Display a Julian calendar, instead of the default Gregorian calendar. All days are numbered from January 1, rather than from the beginning of the month. If combined with -o, display the date of Orthodox Easter according to the Julian calendar.
-e Display the date of Easter for western calendars. This option exists because Easter is an defining date when calculating traditional calendar dates.
-o Display the date of orthodox Easter.
-p Print country codes and "switching days" for switching from Julian to Gregorian calendars in various countries.
-w Print the number of the week under each week column.
-C Behave as if you ran cal, using its options and display output.
-M Display weeks with Monday as the first day.
-S Display weeks with Sunday as the first day. This is the default.
-b Use the calendar display format of cal.

cal examples

cal

Display the calendar for this month, with today highlighted.

cal -h

Same as the previous command, but do not highlight today.

cal -3

Display last month, this month, and next month.

cal -y

Display this entire year's calendar.

cal -y 2000

Display the entire year 2000 calendar.

cal 2000

Same as the previous command.

cal -m December

Display the calendar for December of this year.

cal -m Dec

Same as the previous command.

cal -m 12

Same as the previous two commands.

cal 12

Same as the previous three commands.

cal 12 2000

Display the calendar for December, 2000.

ncal

Display this month's calendar, with weeks arranged vertically rather than horizontally.

ncal -y

Use a vertical calendar representation, displaying the entire year.

calendar — Display appointments and reminders.