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:

cal

Viewing 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 2025

Note: 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 2025

Alternatively, to view the entire calendar for the current year, use the -y option:

cal -y

Displaying Multiple Months

To view the previous month, the current month, and the next month simultaneously, use the -3 flag:

cal -3

Additional Useful Options

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.