LinuxCommandLibrary

cal

Display a calendar

TLDR

Display a calendar for the current month

$ cal
copy

Display a calendar for a specific year
$ cal [year]
copy

Display a calendar for a specific month and year
$ cal [month] [year]
copy

SYNOPSIS

cal [-1] [-3] [-A num] [-B num] [-d date] [-J] [-j] [-m fmt] [-s] [-w] [-y] [[month] year]

PARAMETERS

-1
    Display a single month's calendar (default)

-3
    Display previous, current, and next month calendars side-by-side

-A num, --after=num
    Display num months after the reference month

-B num, --before=num
    Display num months before the reference month

-d date, --date=date
    Use specified date (formats: MMDD, YYYY-MM-DD, etc.) as reference

-J
    Display ISO week dates instead of Julian

-j
    Display Julian day-of-year numbers

-m fmt, --month=fmt
    Month name format (e.g., '%B %Y')

-s, --sunday
    Weeks start on Sunday

-w
    Print ISO week numbers at start of lines

-y, --year
    Display entire year calendar

DESCRIPTION

The cal command is a lightweight Unix utility for printing calendars in a simple ASCII grid format to standard output. By default, it displays the current month, showing days aligned under abbreviated weekday headers (Monday to Sunday). Specify a month (1-12) and year for any date, or use -y to view a full year's calendar spanning 12 or 3 rows of months.

Options enhance flexibility: -3 shows the previous, current, and next month side-by-side; -s starts weeks on Sunday; -j adds Julian day-of-year numbers; -w includes week numbers. Advanced features like -A and -B allow multi-month spans around a reference date set by -d, supporting formats like MMDD or YYYY-MM-DD.

Ideal for terminal use, scripting, or quick date checks, cal assumes a proleptic Gregorian calendar, extending rules backward indefinitely. Output is compact, typically 20-24 columns wide, fitting most terminals without wrapping.

CAVEATS

Uses proleptic Gregorian calendar; pre-1582 dates follow modern rules and may differ from historical Julian calendar. No locale-aware month names by default.

EXAMPLES

cal
cal 8 2024
cal -y 2024
cal -3
cal -d 2024-12-25 -A 1 -B 1
cal -j -w

HISTORY

First appeared in Version 7 Unix (AT&T, January 1979). Evolved in BSD and Linux implementations, with modern versions in util-linux adding options like -A and -d.

SEE ALSO

ncal(1), date(1)

Copied to clipboard