Linux cal command Examples

cal command in Linux offers quick view of calendar within Linux terminal interface. Means, if a user want to view calendar from command line, this command can be helpful. This command shows the current month calendar as output by default, however the output can be altered according to requirement by using various options.

Syntax of cal command in Linux

cal

or

cal [ [ month ] year]

Options available to use with cal command:

  • -h: Used for not highlighting today’s date.
  • -m month: Used for specifying month (Either use full month name, or the first three letters. Month number can also be specified)
  • -y year: Specifies a year to display.
  • -3: Shows 3 consecutive month calendar starting from last month.
  • -1: Shows current month only.
  • -A num: Shows num (number) months after a specified month.
  • -B num: Displays num (number) months before specified month.
  • -d YYYY-MM: Shows the specified month of specified year (Eg. 1998-05)
  • -j: Used for showing Julian calendar (Default calendar type is Gregorian).

Examples of cal command in Linux

1: Displaying calendar of current month

cal
Linuc cal command

2: Display 3 consecutive month from last month, with highlighting todays date.

Cal -3
cal command linux

3: Display complete year’s calendar

cal -y 1997
cal command in Linux

4: Display a specified month of this year

cal -m Feb
or
cal -m2
Examples of cal command linux
Also Read:   Using bzcmp Command In Linux- Examples

Nishant

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.