Skip to content

cal Linux Command Guide

The cal command in Linux is used to display a simple calendar in the terminal. It shows the current month by default or allows you to specify a month and year to view. The calendar includes the day of the week, followed by the days of the month. By providing a specific month and year as arguments, you can view calendars for those dates. cal is a handy tool for quickly checking dates and planning events within the terminal environment.

cal Syntax:

Terminal window
cal [options] [month] [year]

Options:

OptionDescription
-1Display single month
-3Display previous, current, and next month
-yDisplay full year

Parameters:

ParameterDescription
monthDisplay calendar for specific month (1-12)
yearDisplay calendar for specific year

cal Command Samples:

Display Current Month Calendar

Terminal window
cal

Display the current month’s calendar.

Display Specific Year Calendar

Terminal window
cal 2023

Display the calendar for the year 2023.

Display Specific Month Calendar of a Year

Terminal window
cal 7 2024

Display the calendar for July 2024.

Show Calendar in Landscape Format

Terminal window
cal -m

Display the calendar in landscape format.

Display Specific Month and Year Calendar

Terminal window
cal 12 2022

Display the calendar for December 2022.

Display Calendar with a Specific Starting Day

Terminal window
cal -s 3

Display the calendar with Wednesday as the starting day of the week.

Show Julian Days in Calendar

Terminal window
cal -J

Display Julian days in the calendar output.

cal FAQ:

How do I use cal in Linux?

To use the cal command in Linux, execute the following command:

Terminal window
cal

How can I display a specific month using cal in Linux?

To display a specific month with the cal command in Linux, provide the month and year as arguments:

Terminal window
cal 12 2022

How can I highlight the current day when using cal in Linux?

To highlight the current day when running the cal command in Linux, use the -h flag:

Terminal window
cal -h

How do I show a full year calendar using cal in Linux?

To display a full year calendar with the cal command in Linux, provide the year as an argument:

Terminal window
cal 2023

How can I display a calendar for a specific year range with cal in Linux?

To show a calendar for a specific year range using the cal command in Linux, provide the start and end year as arguments:

Terminal window
cal 2022 2025

How do I show the calendar month in a specific format using cal in Linux?

To display the calendar month in a specific format using the cal command in Linux, use the -3 flag:

Terminal window
cal -3

Applications of the cal Command

  • Display a calendar for the current month
  • Display a calendar for a specific month and year
  • Show a calendar for a specific year
  • Highlight the current day in the calendar
  • View different months or years by specifying the month and year