LinuxCommandLibrary

calendar

Display upcoming events from calendar file

TLDR

Show events for today and tomorrow (or the weekend on Friday) from the default calendar

$ calendar
copy

Look [A]head, showing events for the next 30 days
$ calendar -A [30]
copy

Look [B]ack, showing events for the previous 7 days
$ calendar -B [7]
copy

Show events from a custom calendar [f]ile
$ calendar -f [path/to/file]
copy

SYNOPSIS

calendar [-abdfjmptwWy] [-A number] [-B number] [-c filename] [-C filename] [-e filename] [-l number] [-n number] [-s string]

PARAMETERS

-a
    Process all users' calendar files in the default calendar directory.

-A number
    Display events occurring within the next number days.

-B number
    Display events occurring within the past number days.

-b
    Enable beta features.

-c filename
    Specify an alternative calendar file.

-C filename
    Specify an alternative calendar file (same as -c).

-d
    Enable debugging mode.

-e filename
    Use filename as the first calendar file to check (other than ~/.calendar).

-f
    Process the specified calendar file, even if it's not in the default location.

-j
    Use Julian dates.

-l number
    Treat the current day as day 'number'.

-m
    Run mbox processing before checking calendar entries.

-n number
    Ignored.

-p
    Pipe calendar entries to command.

-s string
    Perform simple text searches using strstr().

-t
    Run calendar on today only.

-w
    Include weekend days.

-W
    Include the next weekend in the date range.

-y
    Display events for the current year.

DESCRIPTION

The calendar command is a simple yet useful utility for displaying upcoming events or reminders based on specially formatted entries found in your calendar files. These files are typically named calendar (or similar) and reside in your home directory. The command parses these files for lines that match the current or upcoming dates, displaying those lines as reminders. It's a convenient way to keep track of appointments, birthdays, or other recurring events directly from the command line. The command is highly configurable through various options, letting you adjust how far into the future to search and use alternative files.

CAVEATS

The date format in the calendar file must be recognized by the command. Ambiguous date formats can lead to unexpected behavior. The command's behavior can be unpredictable if the locale is not set correctly.

CALENDAR FILE FORMAT

Calendar files consist of lines containing date specifications followed by a description of the event. Dates can be specified in various formats, including month/day, day/month, or using special keywords like 'today', 'tomorrow', and 'eom' (end of month).

Examples:
Dec 25 Christmas Day
12/25 Christmas Day
today Meeting
Jan 1, 2024 New Year's Day

Lines starting with a space or tab are treated as continuations of the previous line.

DEFAULT CALENDAR DIRECTORY

The calendar command typically looks for calendar files in the ~/.calendar directory, but this can vary depending on the specific system configuration. The /etc/calendar directory may also be used for system-wide calendar entries.

HISTORY

The calendar command has been a part of Unix-like systems for a long time, predating modern graphical calendar applications. Its origins lie in the early days of Unix, where simple text-based tools were essential for managing tasks and schedules. It has evolved alongside the operating system, with various implementations and minor feature enhancements over the years. It continues to be used today by many system administrators and users who prefer command-line tools for its simplicity and efficiency.

SEE ALSO

date(1), cron(8)

Copied to clipboard