LinuxCommandLibrary

ncal

Display a calendar in the terminal

TLDR

View documentation for the original command

$ tldr cal
copy

SYNOPSIS

ncal [OPTIONS] [[month] year]

PARAMETERS

-A months
    Displays months after the current month. For example, -A 3 shows the current month and the next three.

-B months
    Displays months before the current month. For example, -B 2 shows the current month and the previous two.

-b
    Uses the Julian calendar for output, showing dates according to the Julian calendar system.

-C | -c
    Displays output in the traditional cal format, with Sunday as the first day of the week.

-d yyyy-mm
    Displays the calendar for a specific month and year, e.g., 2023-12.

-H yyyy-mm-dd
    Highlights a specific date in the calendar, e.g., 2024-07-15. Useful for marking appointments or special days.

-h
    Turns off highlighting of the current day. By default, today's date is highlighted.

-J
    Displays Julian dates (day of year) for each day, numbered from 1 to 365 (or 366 for leap years).

-M | -m
    Explicitly sets Monday as the first day of the week. This is the default behaviour of ncal.

-p
    Prints the date of Easter for the specified year. If no year is given, it defaults to the current year.

-S digits
    Adjusts the number of spaces between month columns in the output.

-s country
    Specifies a country for Easter calculation or regional formatting, although its practical impact varies.

-V
    Displays the version information of the ncal command.

-w
    Prints the number of the week below each week. Week numbers are typically ISO 8601 compliant.

-y
    Displays a calendar for the entire current year.

month [year]
    Displays the calendar for a specific month (1-12) and optionally year (1-9999). If only month is provided, the current year is assumed.

DESCRIPTION

ncal is a modern and enhanced version of the traditional cal command, designed to display a calendar on the terminal. By default, ncal adheres to the ISO 8601 standard, presenting weeks starting on Monday. This distinguishes it from cal, which typically starts weeks on Sunday.

Beyond its default Monday-first view, ncal offers a rich set of features including the ability to display multiple months before or after the current one, show Julian dates (day of year), and highlight a specific date. It can also print the date of Easter for a given year. For users accustomed to cal's layout, ncal provides options to emulate its Sunday-first week display. Its flexibility and adherence to international standards make it a powerful tool for calendar viewing in the Linux environment.

CAVEATS

ncal defaults to Monday as the first day of the week, aligning with ISO 8601. This differs from the traditional cal command, which typically uses Sunday as the first day. Users expecting cal's default behavior should use the -C or -c option.

Easter calculation is based on the Gregorian calendar.

<B>ENVIRONMENT</B>

The LC_TIME environment variable influences the display of month and weekday names, respecting locale settings. The TZ environment variable determines the timezone used for displaying the current date and time.

<B>EXIT STATUS</B>

The ncal command exits with a status of 0 on successful execution, and a non-zero value (>0) if an error or invalid usage occurs.

HISTORY

ncal first appeared in NetBSD 1.5 as a more feature-rich alternative to the original cal command. Its development aimed to provide greater flexibility, particularly in supporting ISO 8601 week numbering (Monday-first) and enhanced calendar display options such as multiple month views and date highlighting. It has since been adopted by other Unix-like systems, including Linux, offering a modern and standards-compliant calendar utility.

SEE ALSO

cal(1)

Copied to clipboard