FactorPad
Build a Better Process

Linux cal Command Summary with Examples

Linux cal allows you to display a calendar.
  1. Purpose - Learn what cal is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with cal.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
In this tutorial on Linux cal, 42 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / cal-command.html


An ad-free and cookie-free website.


Examples of the Linux cal Command

Beginner

Learn to display a monthly or yearly calendar at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux cal Command Summary with Examples (2:59)

Video Script

The Command and Why You Need It

Our forty-second word, or command to memorize is cal from our category System.

cal allows you to display a calendar.

Common Linux cal Options
-options description
-3 Show a calendar for three months
-y Display a calendar for the whole year

Recall from the previous video, we used the calendar command to display reminders and send updates, now with cal, we have an easy command offering a calendar view.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The cal command has 6 options and no arguments.

Unlike most commands, help isn't available with double-dash --help, so I suggest using the man cal command for documentation. The default is the current month, and with -3 view three months, and for the whole year use the -y option.

You can also customize this and get more granular, but I figure you'll use your phone, email program or wall calendar for that.

So why is cal an important command? Well, if you're completely focused on the terminal and don't want to turn your attention away from the screen, cal offers a quick way to remember what the heck day it is. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. Let's do a cal without options for the current month.

$ cal October 2016 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

Next, we'll do a cal with the minus or -3 option to add the surrounding two months.

$ cal -3 September 2016 October 2016 November 2016 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 1 1 2 3 4 5 4 5 6 7 8 9 10 2 3 4 5 6 7 8 6 7 8 9 10 11 12 11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19 18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26 25 26 27 28 29 30 23 24 25 26 27 28 29 27 28 29 30 30 31 $ clear

And last, let's throw in a -y option for the whole year.

$ cal -y 2016 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 1 2 3 4 5 3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12 10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19 17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 26 24 25 26 27 28 29 30 28 29 27 28 29 30 31 31 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 7 1 2 3 4 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11 10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18 17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 1 2 3 4 5 6 1 2 3 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10 10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17 17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24 24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30 31 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 2 3 4 5 1 2 3 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17 16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31

A Final Tip

Okay now you know how to use cal. And you know the syntax for commands, options and arguments.

One last tip about the cal command. So again, I think cal is best for a quick look at a recent month, or few months, but check out the -m option in the man cal page to review other months, or years.

Okay, thanks for visiting today. I hope this was a helpful introduction to the cal command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

If you learned something today, please consider subscribing. Every bit of support helps.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / cal-command.html


linux cal command
cal linux
linux cal
unix cal
cal unix
linux cal examples
linux calendar
display cal linux
linux system calendar
linux cal options
man cal
linux cal tutorial
open source calendar
cal calendar
linux cal syntax
linux monthly calendar

A newly-updated free resource. Connect and refer a friend today.