cal command in Linux with 8 practical examples

cal command displays a calendar, let’s see how to display a calendar in different ways using cal command

cal command

1. Print Current month calendar

using cal command we can print current month calendar

# cal

# cal -1

2. Display previous/current/next month calendar using single command

We can print previous, current and next month calendar using ‘-3’ option along with ‘cal’ command

# cal -3

3. Display specified year calendar

we can also print an specified year calendar by providing the year number along with the cal command

# cal -y

# cal 2016

4. Display particular month of the year calendar

We can also print the month of the year in calendar

# cal 9 2017

# cal 8 2016

5. Print number of days in year using -j option

When we would like to print an days of the year we can use ‘-j’ along with cal command to see number of days in a year

# cal -j

# cal -j -3

6. Display Monday as the first day of the week.

using ‘-m’ option we can display the calendar week start with Monday

# cal -m

7. Display Sunday as the first day of the week

using ‘-s’ along with cal command we can display the calendar start with Sunday as first week of the day

# cal -s

8. Display the version of cal command

We can check the ‘cal’ command version using ‘–version’ & ‘-V’ option

[root@TechTutorial ~]# cal -V
cal from util-linux 2.23.2
[root@TechTutorial ~]# cal --version
cal from util-linux 2.23.2

That’s it about the cal command.

Please provide your valuable comments

Related Articles

ls 25 practical examples in Linux

25 commonly used commands in Linux

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *