calendar
Display upcoming events from calendar file
TLDR
Show events for today and tomorrow (or the weekend on Friday) from the default calendar
Look [A]head, showing events for the next 30 days
Look [B]ack, showing events for the previous 7 days
Show events from a custom calendar [f]ile
SYNOPSIS
calendar [-a] [-A num] [-e] [-f file] [-h] [-i] [-j] [-m] [-s string] [-w num] [-] [file]
PARAMETERS
-a
Include calendars from all users (system-wide and personal).
-A num
Look ahead num days for matches (default: 7).
-e
Executive mode: show only lines starting with *.
-f file
Use alternate calendar file instead of ~/.calendar.
-h
Highlight current date in output.
-i
Ignore month names (day/month matching only).
-j
Display dates in Julian (day-of-year) format.
-m
Match month name anywhere in line.
-s string
Use string as separator before output (default: "RUNNING CALENDAR:").
-w num
Wrap output lines at num columns.
-
Read calendar data from standard input.
DESCRIPTION
The calendar command is a classic Unix reminder utility that scans plain-text calendar files for entries matching the current date or future dates within a look-ahead period. Defaulting to the user's ~/.calendar file, it outputs relevant lines, making it ideal for tracking appointments, holidays, birthdays, and deadlines.
Calendar files contain lines where the date prefix uses formats like full month names (January 1), abbreviations (Jan 1), numeric (1/1), day-of-week (Monday), or week numbers (week 1). Asterisks (*) mark high-priority "executive" entries. System-wide files in /usr/share/calendar/ handle holidays and observances.
Often run daily via cron (e.g., 0 7 * * * calendar -a | mail $USER), it supports customization for multi-user views, adjustable ranges, and output tweaks. Simple and script-friendly, calendar excels in terminal environments but lacks graphical or recurring event support found in modern tools.
Its pattern-matching parser is robust for English locales but may falter with non-standard dates. Widely available on Linux via bsdmainutils, it promotes lightweight, text-based productivity.
CAVEATS
Date parsing is locale-sensitive and English-centric; complex recurring events unsupported. Files must follow strict prefix format or entries are ignored. Not suitable for interactive use.
CALENDAR FILE FORMAT
Each line starts with a date prefix (January 1, Jan 1, 1, Monday, week 5, or * Jan 1 for priority) followed by event text. Use # for comments. Example:
January 1: New Year's Day
* Apr 15: Tax deadline!
DEFAULT USAGE
Cron example: 0 8 * * * /usr/bin/calendar -a | mail -s "Daily reminders" $LOGNAME
Outputs matches or "No calendar entries".
HISTORY
Introduced in 4.2BSD (1983) as part of Bill Joy's vi/calendar suite. Ported to Linux via bsdmainutils package; evolved minimally for POSIX compatibility while retaining BSD roots.


