‘ Cal ‘ command display calendar, date, month and year in Linux/Unix Operating System

‘cal’ command generally  used to  display a calendar in Linux/Unix OS. .If no options are given with ‘cal’ command it displays the current month calendar.

If you want to display current month calendar , you can use ‘ cal ‘ or  ‘ cal -1 ‘ or ‘ cal –one ‘.

[root@localhost ~]# cal
November 2017

Su Mo Tu We Th Fr Sa
                     1     2     3    4
   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

[root@localhost ~]# cal   -1

November 2017

Su Mo Tu We Th Fr Sa

                     1     2     3    4

   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

[root@localhost ~]# cal   –one

November 2017

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

If you want to display  previous, current and next month calendar, you can use ‘cal ‘ command with -3 or –three option .

[root@localhost ~]# cal -3

sdr

[root@localhost ~]# cal –three

sdr


 

 

 

If you want to display Sunday as first day of week, you can use ‘cal ‘ command with -s or –sunday option .

[root@localhost ~]# cal -s

November 201

Su Mo Tu We Th Fr Sa
                    1     2     3    4
   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

If you want to display Monday as first day of week, you can use ‘cal ‘ command with -m or –monday option .

[root@localhost ~]# cal -m

November 2017

Mo Tu We Th Fr Sa Su
                  2   3    4   5
     7    8     9  10 11 12
13  14  15  16   17 18 19
20   21  22  23  24 25 26
27   28  29  30

If you want to display Julian dates ,you can use ‘cal ‘ command with -j or  –Julian option .

[root@localhost ~]# cal -j

November 2017

Sun Mon Tue Wed Thu Fri Sat
                            305 306 307 308
309  310  311   312  313  314 315
316  317  318  319   320  321 322
323 324   325  326  327  328  329
330 331   332  333  334 

If you want to display whole current year calendar, you can use ‘cal ‘ command with -y or  –year option .

[root@localhost ~]# cal -y

whole cal

If you want to check Version information of the  ‘ cal ‘ utility , you can use -V or –version   option with ‘cal’      

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

All command line options  used with the ‘ cal ‘ command are shown below

___________________________________________________________

Options:                                             Description

____________________________________________________________
-1, –one                 show only current month (default)
-3, –three              show previous, current and next month
-s, –sunday           Sunday as first day of week
-m, –monday       Monday as first day of week
j, –julian              output Julian dates
-y, –year               show whole current year
-V, –version         display version information and exit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s