cal Command

Purpose

Displays a calendar.

Syntax

cal [ [ Month Year ]

Description

The cal command displays a calendar of the specified year or month.

The Year parameter names the year for which you want a calendar. Since the cal command can display a calendar for any year from 1 through 9999, you must enter the full year rather than just the last two digits. The Month parameter identifies the month for which you want the calendar. It can be a number from 1 (indicating January) to 12 (indicating December). If you specify neither the Year nor the Month parameter, the cal command displays the current month. If you specify only one parameter, the cal command assumes the parameter is the Year parameter and displays the calendar for the indicated year.

Note: The cal command does not accept standard input.

The cal command uses the appropriate month and day names according to the locale settings.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Examples

  1. To display a calendar for February, 1994, at your workstation, enter:
    cal 2 1994
  2. To print a calendar for 1994, enter:
    cal 1994 | qprt
  3. To display a calendar for the year 84, enter:
    cal 84

Files

Item Description
/usr/bin/cal Contains the cal command.