System and processes

The cal command

Shows a calendar of one month, three months or a whole year in the terminal, without leaving the shell.

Syntax

cal [opciones] [[día] mes] [año]Try it in the terminal →

Most useful options

-1, --oneA single month. It is the default behaviour
-3, --threeThree months in a row: the previous, the current and the next
-n, --months NShows N months starting from the month that contains the given date
-y, --yearFull calendar of the year. Giving only the year produces the same result
-Y, --twelveThe next twelve months, starting with the current one
-s, --sundayForces the week to start on Sunday
-m, --mondayForces the week to start on Monday, with ISO 8601 week numbering
-w, --week [=N]Adds the number of each week. With =N it highlights week N of the year

Copy-ready examples

$ calcalendar of the current month. Today is highlighted in a terminal.
$ cal 3 2027March 2027. The first number is the month and the second the year.
$ cal -3the previous, current and next month, according to the system date.
$ cal -m 3 2027March 2027 with the week starting on Monday.
$ cal -w 3 2027March 2027 with the number of each week on the left.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
cal: illegal month value: use 1-12The month is outside the range 1 to 12. It is common to write the year and the month in the wrong order.Write the month first and the year after: cal 3 2027.
cal: illegal day value: use 1-28The day does not exist in that month. February 2027 has 28 days.Check the day against the month given, or drop it and keep only the month and year.
cal: failed to parse timestamp or unknown month name: marzoWith a single non-numeric argument, cal looks for a month name in the current locale. With LC_ALL=C it only accepts English names.Write the month as a number, for example cal 3 2027, or use a locale that recognises the name.

Typical mistakes

  • A single number is taken as a year: cal 3 shows the whole year 3, not March. For March write cal 3 2027.
  • The first day of the week is set by the locale. With -s or -m you fix it yourself, without depending on the system language.
  • The highlighted day only appears in a terminal. In a file or a pipe the calendar comes out without marks.
  • On Debian and Ubuntu, cal often comes from the ncal package, where some options differ: there -m picks the month and -M starts on Monday. The ones on this page are from util-linux.

Differences from similar commands

  • ncal: shows the calendar in a vertical layout, like cal -v. Same data, another way of drawing it.
  • date: shows the current date and time without drawing any month. To see which weekday a given date falls on, cal is the right tool.

Related commands

FAQ

Can I see several months?

Yes: cal -3 shows the previous, current and next. With -n you choose how many.

How do I see a whole year?

With cal -y 2027 or with cal 2027. Both forms show the twelve months of the year.

How do I change the first day of the week?

With -s to start on Sunday or -m to start on Monday. Without either, the locale decides.

Why don't I see today highlighted?

Because the output is not going to a terminal, or because colour is off. If the NO_COLOR variable is set, cal does not colourise.

More System and processes commands

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course