Our Knowledge Base provides step-by-step guides, troubleshooting tips, and expert insights to help you manage VPS, dedicated servers, domains, DDoS protection, and more — all designed to make your experience with us fast, secure, and stress-free.
Sometimes, you might want to have a peek at the year’s calendar or even narrow it down to a month’s calendar. The Linux cal command is an excellent built-in tool that displays a calendar of a given year or month depending on the options passed.
In Linux and Unix-like systems, the “cal” is a command-line utility that prints the calendars on the terminal. “Cal” is an abbreviated form of Calendar. It is a pretty simple command and doesn’t contain many options. There are a few options to display – year, month, or date – on the console.
To install the “cal” command on Linux operating system, launch the terminal and type the following command:
$ sudo apt install ncal
The cal command takes the following command syntax:
$ cal [month] [year]
In its basic format, the cal command prints out the current month and highlights the present day. For instance, by the time I’m writing this, the date is December 17, 2022.
$ cal
To print a specific month of the year, provide the numeric value of the month [ 1 – 12 ] followed by the year.
For example, to display the first month of 2023, run the following command:
$ cal 1 2023
This prints out the calendar dates for the first month (January) only.
Alternatively, you can invoke the -m option followed by the month of the year. If the year is not provided as an argument, the month of the current year is printed instead.
$ cal -m June
Let’s try out something more ambitious. The cal command also allows you to print the previous, current, and the next month. Simply pass the -3 option at the end.
$ cal -3
To print the entire traditional calendar for the current year, run the following command:
$ cal -y
To view the calendar of a different year, for example 2024, specify the year after the cal command as shown in the following:
$ cal 2024
These are some of the commonly used cal commands. However, if curiosity gets the better of you, find more command options by visiting the cal man pages using the following command:
$ man cal
The “cal” command is a quite helpful command that is used to display a calendar on the terminal in Linux and Unix- like systems. The Linux cal command displays a simple calendar that allows you to view the current month of the year, the entire current year, or other months or years, depending on your command arguments.