This blog is under construction

Wednesday, 24 February 2016

LINUX cal command examples

cal utility is used to display calendar of any specific month or year.  Below are few examples for linux cal command usage.
  • Display calendar of any specific year
  • Display calendar of current month
  • Display calendar of any specific month in current year
  • Display calendar of any specific month in any specific year
  • Display Julian calendar of current year
  • Display Julian calendar of any specific year
  • Display Julian calendar of any specific month
  • Display Julian calendar of any specific month in any specific year
  • Display calendar without high lighting current date
  • Display previous, current and next month calendar highlighting current date
  • Display previous, current and next month calendar without highlighting current date
  • Display previous, current and next month in Julian calendar highlighting current date
  • Display previous, current and next month in Julian calendar without highlighting current date
  • Display calendar of given month in following year
  • Display calendar of given month in previous year

LINUX cal command examples:
Display calendar of any specific year
cal   -y   <year>
cal  <year>

jp@jp-VirtualBox:~$ cal 2016
                             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                                       

Display calendar of current month
cal

jp@jp-VirtualBox:~$ cal
   February 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

Display calendar of any specific month in current year
jp@jp-VirtualBox:~$ cal -m 4
     April 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

Display calendar of any specific month in any specific year
jp@jp-VirtualBox:~$ cal 10 2010
    October 2010
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

Display Julian calendar of any specific year
jp@jp-VirtualBox:~$ cal -j 2016
                          2016

          January                     February
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
                      1   2       32  33  34  35  36  37
  3   4   5   6   7   8   9   38  39  40  41  42  43  44
 10  11  12  13  14  15  16   45  46  47  48  49  50  51
 17  18  19  20  21  22  23   52  53  54  55  56  57  58
 24  25  26  27  28  29  30   59  60
 31                          
           March                        April
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
         61  62  63  64  65                       92  93
 66  67  68  69  70  71  72   94  95  96  97  98  99 100
 73  74  75  76  77  78  79  101 102 103 104 105 106 107
 80  81  82  83  84  85  86  108 109 110 111 112 113 114
 87  88  89  90  91          115 116 117 118 119 120 121
                             
            May                         June
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
122 123 124 125 126 127 128              153 154 155 156
129 130 131 132 133 134 135  157 158 159 160 161 162 163
136 137 138 139 140 141 142  164 165 166 167 168 169 170
143 144 145 146 147 148 149  171 172 173 174 175 176 177
150 151 152                  178 179 180 181 182
                             
           July                        August
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
                    183 184      214 215 216 217 218 219
185 186 187 188 189 190 191  220 221 222 223 224 225 226
192 193 194 195 196 197 198  227 228 229 230 231 232 233
199 200 201 202 203 204 205  234 235 236 237 238 239 240
206 207 208 209 210 211 212  241 242 243 244
213                          
         September                     October
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
                245 246 247                          275
248 249 250 251 252 253 254  276 277 278 279 280 281 282
255 256 257 258 259 260 261  283 284 285 286 287 288 289
262 263 264 265 266 267 268  290 291 292 293 294 295 296
269 270 271 272 273 274      297 298 299 300 301 302 303
                             304 305
         November                     December
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa
        306 307 308 309 310                  336 337 338
311 312 313 314 315 316 317  339 340 341 342 343 344 345
318 319 320 321 322 323 324  346 347 348 349 350 351 352
325 326 327 328 329 330 331  353 354 355 356 357 358 359
332 333 334 335              360 361 362 363 364 365 366

Display Julian calendar of any specific month in current year
jp@jp-VirtualBox:~$ cal -j
       February 2016
 Su  Mo  Tu  We  Th  Fr  Sa
     32  33  34  35  36  37
 38  39  40  41  42  43  44
 45  46  47  48  49  50  51
 52  53  54  55  56  57  58
 59  60
Display Julian calendar of any specific month in any specific year
jp@jp-VirtualBox:~$ cal -j 10 2012
       October 2012
 Su  Mo  Tu  We  Th  Fr  Sa
    275 276 277 278 279 280
281 282 283 284 285 286 287
288 289 290 291 292 293 294
295 296 297 298 299 300 301
302 303 304 305
Display calendar without highlighting current date
jp@jp-VirtualBox:~$ cal -h -m 2
   February 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
Display previous, current and next month calendar highlighting current date
jp@jp-VirtualBox:~$ cal -3
    January 2016         February 2016           March 2016       
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    

Display previous, current and next month calendar highlighting current date
jp@jp-VirtualBox:~$ cal -h -3
    January 2016         February 2016           March 2016       
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  

Display previous, current and next month in Julian calendar highlighting current date
jp@jp-VirtualBox:~$ cal -j -3
       January 2016                 February 2016                 March 2016           
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa  
                      1   2       32  33  34  35  36  37           61  62  63  64  65
  3   4   5   6   7   8   9   38  39  40  41  42  43  44   66  67  68  69  70  71  72
 10  11  12  13  14  15  16   45  46  47  48  49  50  51   73  74  75  76  77  78  79
 17  18  19  20  21  22  23   52  53  54  55  56  57  58   80  81  82  83  84  85  86
 24  25  26  27  28  29  30   59  60                       87  88  89  90  91
 31 

Display previous, current and next month in Julian calendar without highlighting current date
jp@jp-VirtualBox:~$ cal -jh -3
       January 2016                 February 2016                 March 2016           
 Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa   Su  Mo  Tu  We  Th  Fr  Sa  
                      1   2       32  33  34  35  36  37           61  62  63  64  65
  3   4   5   6   7   8   9   38  39  40  41  42  43  44   66  67  68  69  70  71  72
 10  11  12  13  14  15  16   45  46  47  48  49  50  51   73  74  75  76  77  78  79
 17  18  19  20  21  22  23   52  53  54  55  56  57  58   80  81  82  83  84  85  86
 24  25  26  27  28  29  30   59  60                       87  88  89  90  91
 31   

Display calendar of given month in previous year
jp@jp-VirtualBox:~$ cal -m2p
   February 2015
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

Display calendar of given month in following year
jp@jp-VirtualBox:~$ cal -m2f
   February 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

19 comments:

  1. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from

    ReplyDelete
  2. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from

    ReplyDelete
  3. There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this.
    SAS training in chennai

    ReplyDelete

  4. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    regards,

    Melbourne SEO services

    ReplyDelete
  5. Programming is combination of intelligent and creative work. Programmers can do anything with code. The entire Programming tutorials that you mention here on this blog are awesome. Beginners Heap also provides latest tutorials of Programming from beginning to advance level.
    Be with us to learn programming in new and creative way.

    ReplyDelete
  6. It is superb content I thought and even I was searching similar this subject articles for knowing about it. And I truly enjoyed to read plus collected a tremendous information about it.

    ClayAnderson
    college essay writing service

    ReplyDelete
  7. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from Pprogramming

    ReplyDelete
  8. Programming is combination of intelligent and creative work. Programmers can do anything with code. The entire Programming tutorials that you mention here on this blog are awesome. Beginners Heap also provides latest tutorials of Programming from beginning to advance level.
    Be with us to learn programming in new and creative way.

    ReplyDelete
  9. Replies
    1. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!
      aqtsoft.com

      Delete
  10. Thanks a lot! You made a new blog entry to answer my question; I really appreciate your time and effort.java training in chennai | chennai's no.1 java training in chennai | best java institute in chennai

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. NICE SIR... VERY GOOD POST
    PROGRAM EXERCISE KE LIYE BAHUT ACHHA HAI

    ReplyDelete
  14. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it.What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity.
    Java Training in Chennai

    ReplyDelete
  15. Thanks a lot! You made a new blog entry to answer my question; I really appreciate your time and effort
    sbobet
    baccarat
    online baccarat

    ReplyDelete