Skip to main content

cal command

Detailed Explanation

The cal command is a simple utility that displays a formatted calendar in the terminal. If no arguments are provided, it displays the calendar for the current month with the current day highlighted.

Basic Syntax

cal [options] [[[day] month] year]

Common Flags/Options

OptionDescription
-yDisplay a calendar for the whole year.
-3Display the previous, current, and next month surrounding today.
-mDisplay Monday as the first day of the week.
-sDisplay Sunday as the first day of the week (default).

Real-world Examples

Show the calendar for the current month:

cal

Show the calendar for the whole current year:

cal -y

Show the calendar for a specific year (e.g., 2024):

cal 2024

Show the calendar for a specific month and year (e.g., July 2024):

cal 7 2024

Show three months (previous, current, next):

cal -3