Linux Cal Command: How to Display a Terminal Calendar
The cal command in the Linux operating system is a
built-in command-line utility used to display formatted calendars
directly in the terminal. This guide covers the function of the
cal command, its default behavior, and practical examples
using common flags to display specific months, entire years, Julian
dates, and multi-month views.
What Is the cal Command?
The primary function of the cal (calendar) command is to
generate a simple, text-based calendar grid within the Linux shell. It
is lightweight, fast, and does not require a graphical user interface
(GUI), making it ideal for system administrators and command-line power
users who need quick date referencing.
Basic Usage
Running the cal command without any arguments prints the
calendar for the current month, with the current day highlighted:
calViewing a Specific Month and Year
You can display any specific month and year by passing the month (1-12) and the full four-digit year as arguments:
cal 7 2025Note: Always specify the full four-digit year (e.g.,
2025 instead of 25) to avoid generating a
calendar for the first century CE.
Viewing an Entire Year
To view the entire 12-month calendar for a given year, pass only the year argument:
cal 2025Alternatively, to view the entire calendar for the current year, use
the -y option:
cal -yDisplaying Multiple Months
To view the previous month, the current month, and the next month
simultaneously, use the -3 flag:
cal -3Additional Useful Options
- Monday as First Day of the Week (
-m): By default,caloften starts the week on Sunday. Use-mto start the week on Monday:cal -m - Sunday as First Day of the Week (
-s): Explicitly forces the week to begin on Sunday:cal -s - Julian Days (
-j): Displays the calendar using Julian days (day of the year, numbered 1 to 365/366) instead of standard day-of-the-month numbers:cal -j
The ncal Alternative
On many modern Linux distributions, the cal utility is
provided alongside ncal. Running ncal displays
the calendar in an alternate vertical layout, with days of the week
listed vertically on the left and dates progressing horizontally across
columns.