cal Command Cheat Sheet
cal (calendar) is a standard Unix utility that displays a simple, formatted calendar in the terminal. It is useful for quick date references, checking days of the week, and scripting date-related tasks.
Synopsis
cal [options] [[month] year]
Description
cal displays a calendar for the current month by default. It can also display a specific month, a whole year, or format the output in various ways (Julian dates, Monday start, etc.).
Basic Usage
Current Month
cal
Displays calendar for the current month.
Specific Month and Year
cal 12 2025
Displays December 2025.
Specific Year
cal 2024
Displays calendar for the entire year 2024.
Command Line Options
| Option | Description |
|---|---|
-1, --one |
Display single month (default) |
-3, --three |
Display previous, current, and next month |
-s, --sunday |
Display Sunday as first day of week (default in some locales) |
-m, --monday |
Display Monday as first day of week |
-j, --julian |
Display Julian dates (days 1-366) |
-y, --year |
Display calendar for current year |
-V, --version |
Display version information |
-h, --help |
Display help text |
Advanced Formatting
Three-Month View
cal -3
Useful for planning across quarter boundaries.
Julian Dates
cal -j
Displays day of year (1-365/366). Useful for project planning and computing time spans.
Highlight Today
On many systems (util-linux version), the current day is highlighted automatically. To disable:
cal --nocolor
To force color:
cal --color=always
Practical Examples
Quick Date Check
cal
Plan Next Month
cal -m $(date -d "next month" +%m) $(date -d "next month" +%Y)
Show Fiscal Year
# Alias for fiscal year view (e.g., Oct-Sep)
alias fiscal='cal -m 10 2025; cal -m 11 2025; ...'
Create Text Calendar File
cal 2025 > calendar_2025.txt
Great for printing or ASCII art inclusion in docs.
Scripting with cal
Extract Specific Date
Find the day of week for a specific date:
cal 12 2025 | grep -C 1 25
Count Fridays in a Month
cal 12 2025 | awk '{print $6}' | grep -v "^$" | wc -l
Highlight Specific Day in Output
cal | grep --color -C 6 "$(date +%e)"
Generate Calendar for Last Month
cal $(date -d "last month" +%m) $(date -d "last month" +%Y)
Historical Context
cal is one of the oldest Unix commands (V1, 1971).
The Year 1752
Try this:
cal 9 1752
Output:
September 1752
Su Mo Tu We Th Fr Sa
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Why? The British Empire (including American colonies) switched from Julian to Gregorian calendar in September 1752, skipping 11 days. cal accurately reflects this historical fact.
Cross-Platform Differences
BSD cal (macOS)
- Has
-hto disable highlighting (util-linux uses--nocolor) - Layout might differ slightly
ncal (Alternative)
- Available on many systems (often aliased or symlinked)
- Displays calendar vertically by default
- Supports Easter date calculation (
-e)
ncal -M # Monday start, vertical
ncal -e # Show Easter date
Localisation
cal respects locale settings for month names and day abbreviations.
French Calendar
LC_TIME=fr_FR.UTF-8 cal
German Calendar with Monday Start
LC_TIME=de_DE.UTF-8 cal -m
Use Cases
Project Management
Quickly check week numbers (with ncal -w) or dates.
System Administration
"Does the log rotation scheduled for the 3rd Friday match the deployment date?"
ncal -w
ASCII Art / MOTD
Add a calendar to your terminal startup:
# In .bashrc
cal
Exit Status
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (invalid date) |
Tips
- Use
-3- It's the most useful view for context - Combine with
date- For relative date calculations - Check
ncal- If you prefer vertical layout or need week numbers - Mind the 1752 Gap - Just a fun trivia fact!
- Use Alias -
alias cal='cal -3m'(3 months, Monday start)