Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

cal - print calendar

&pagelevel(4)&pagelevel

cal writes a calendar on the standard output.


Syntax


cal[[ month] year]

No argument specified:

cal prints the calendar for the current month.

month

cal prints the calendar for the specified month.

The possible values for month are 1 to 12.

If you specify a value for month, you must also specify a value for year

month not specified:
cal prints the calendar for the entire year.

year

The calendar for the specified year is printed.

The possible values for year are 1 to 9999.

Please note that cal 10, for example, refers to 10 A.D., not 2010.

If you call cal using the argument 1752 or the arguments 9 1752, the output for September is shorter than usual. This is because cal allows for an adjustment of 11 days which took place in that month in 1752.

Exit status

The exit status is non-zero if the values specified for year or month lie outside the permissible range.

Error

Bad argument [ for month | for year ]

The values you have specified for year or month are not within the permissible range.

Variable

TZ

Determine the timezone used to calculate the value for the current month.

Locale

The following environment variables affect the execution of cal:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments). LC_CTYPE governs character classes, character conversion (shifting) and the behavior of character classes in regular expressions.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

LC_TIME

Determine the format and contents of the calendar.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example

Print the calendar for Januar 2009 in the Locale C:

$ cal 1 2009
    January 2009

Su Mo Tu We Th Fr Sa

             1  2  3
 4  5  6  7  8  9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

25 26 27 28 29 30 31