cal

date timelinux
The cal command is one of the most frequently used commands in Linux/Unix-like operating systems. cal Display a calendar in the terminal

Quick Reference

Command Name:

cal

Category:

date time

Platform:

linux

Basic Usage:

cal [options] [arguments]

Common Use Cases

    Syntax

    cal [options] [[[day] month] year]

    Options

    Option Description
    -1, --one Display single month (default)
    -3, --three Display previous, current and next month
    -s, --sunday Display Sunday as the first day of the week
    -m, --monday Display Monday as the first day of the week
    -j, --julian Display Julian dates (day of year, 1-365)
    -y, --year Display a whole year calendar
    -w, --week[=number] Display week numbers (optional start day for week)
    -b, --iso Display ISO week numbers (equivalent to --week=1)
    --color[=when] Colorize the output (auto, always, or never)
    -h, --help Display help text and exit
    -V, --version Display version information and exit

    Examples

    How to Use These Examples

    The examples below show common ways to use the cal command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    #

    Basic Examples:

    # Display current month calendar
    cal
    # Display calendar for a specific month (July 2023) cal 7 2023
    # Display calendar for a specific year (2023) cal 2023
    # Display calendar for a specific date (July 4, 2023) cal 4 7 2023

    Advanced Examples:

    # Display calendar for 3 months (current, previous, next)
    cal -3
    # Display Monday as the first day of the week cal --monday
    # Display Julian dates (days numbered 1-365) cal -j # Display all 12 months of a specific year cal -y 2023 # Show week numbers cal --week # Display calendar without highlighting today cal --color=never # Display calendar from 2020 to 2025 cal 2020 2025

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    Key Features:

    The cal command provides a quick and simple way to view calendar information in the terminal:

    • Display monthly or yearly calendars
    • View calendars for past or future dates
    • Highlight the current date
    • Display week numbers
    • Multiple display format options
    • Configurable first day of the week

    Date Format:

    When specifying dates, the cal command follows these rules:

    • If only one parameter is given, it's interpreted as the year
    • If two parameters are given, they're interpreted as month and year
    • If three parameters are given, they're interpreted as day, month, and year
    • Months can be specified as numbers 1-12
    • Years should be given as 4-digit numbers for clarity

    Historical Note:

    The cal command has been part of Unix-like systems since very early versions. It correctly handles the Gregorian calendar reform, including the transition in September 1752 when 11 days were skipped in the English-speaking world.

    Usage Tips:

    • Use -3 to see the previous, current, and next months at once
    • Use -j when you need to know the day of the year (Julian date)
    • Use -y to plan for the entire year
    • When working across time zones, cal shows the date based on your system's local time
    • Week numbers can be helpful for project planning or fiscal quarters
    • Different regions start weeks on different days; use -m or -s accordingly

    Alternative Tools:

    • ncal: A more modern version with additional formatting options
    • gcal: GNU calendar program with extended features
    • when: A more advanced personal calendar program
    • calendar: A simple reminder service based on calendar files

    Related Commands

    These commands are frequently used alongside cal or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the cal command works in different scenarios.

    $ cal
    View All Commands