cal command in Linux explained
Linux
The cal command is one of the oldest Linux commands. It is used to display a calendar in the command line. It is very useful if you need to quickly check the date and time of certain events.
The cal command is available on all major Linux distributions, including Ubuntu, Debian, CentOS, and Fedora.
Here at Fixwebnode, we shall look into how to use the cal command in Linux.
Table of contents [Show]
The cal command has some useful options. These are:
- -y: Displays the calendar of the current year.
- -m: Displays the calendar of the current month.
- -w: Displays the calendar of the current week.
- -d: Displays the calendar of the chosen day.
- -f: Displays the calendar of the chosen fortnight.
- -H: Displays the calendar in a “horizontal” format.
- -V: Displays the calendar in a “vertical” format.
- -S: Displays the calendar in a “simple” format.
- -n: Displays the calendar of the chosen month.
- -e: Displays the calendar of the chosen year.
- -R: Displays the calendar in a “reverse” format.
Examples of using cal command
1. To display the calendar of the current month, use the command:
$ cal
2. To display the calendar of the current year, use the command:
$ cal -y
3. To display the calendar of the current week, use the command:
$ cal -w
4. To display the calendar of a specific day, use the command:
$ cal -d <day_number>
5. To display the calendar of a specific fortnight, use the command:
$ cal -f <fortnight_number>
6. To display the calendar in a horizontal format, use the command:
$ cal -H
7. To display the calendar in a vertical format, use the command:
$ cal -V
8. To display the calendar in a simple format, use the command:
$ cal -S
9. To display the calendar of a specific month, use the command:
$ cal -n <month_number>
10. To display the calendar of a specific year, use the command:
$ cal -e <year_number>
11. To display the calendar in a reverse format, use the command:
$ cal -R
[Need help in fixing Linux system issues ? We can help you. ]
This article covers how to use the cal command in Different Linux Distributions explained with pactical examples. The cal command is a powerful and useful Linux command. It can be used to quickly view a calendar in the command line. It also has some useful options that can be used to customize the output. The command is available on all major Linux distributions, including Ubuntu, Debian, CentO