Calendaring with cal


Calendaring with cal

One of the handiest Unix utilities is cal, whichlogicallyis a calendar. Find out what today's date is, what day of the week December 31 is, or what the calendar year looks like. As Code Listing 15.1 shows, all you have to do is type cal and any specific options you want.

To Use The cal Utility:

1.

cal

Type cal at the shell prompt to see the current month's calendar, as shown in Code Listing 15.1. Then, start playing with options, as shown in the next few steps.

2.

cal -j

Use cal -j to see the Julian calendar, which shows each day numbered from the beginning of the year. (This argument doesn't work on all systems.)

3.

cal 2004 | more

Pipe cal 2004 to more to see the whole year's calendar.

4.

cal 12 1941

Type cal plus specific dates to view dates for a particular year.

Tips

  • Note that cal is Y2K compliant. If you ask for cal 98, you'll get the calendar for the year 98. That is, 1, 900 and a few years ago.

  • Put cal into your startup configuration files to get a reminder of the date whenever you log in. Check out Chapter 8 for details.


Code Listing 15.1. Just type cal to see the current month's calendar, or check out other calendar options with flags.

[jdoe@frazz jdoe]$ cal      January 2003 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 [jdoe@frazz jdoe]$ cal -j 3 2004          March 2004 Sun Mon Tue Wed Thu Fri Sat      61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  [jdoe@frazz jdoe]$ cal 2004 |  more                              2004        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  3    1  2  3  4  5  6  7       1  2  3  4  5  6  4  5  6  7  8  9 10    8  9 10 11 12 13 14    7  8  9 10 11 12 13 11 12 13 14 15 16 17   15 16 17 18 19 20 21   14 15 16 17 18 19 20 18 19 20 21 22 23 24   22 23 24 25 26 27 28   21 22 23 24 25 26 27 25 26 27 28 29 30 31   29                        28 29 30 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  3                      1          1  2  3  4  5  4  5  6  7  8  9 10    2  3  4  5  6  7  8    6  7  8  9 10 11 12 11 12 13 14 15 16 17    9 10 11 12 13 14 15   13 14 15 16 17 18 19 18 19 20 21 22 23 24   16 17 18 19 20 21 22   20 21 22 23 24 25 26 25 26 27 28 29 30      23 24 25 26 27 28 29   27 28 29 30                                       30 31         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  3    1  2  3  4  5  6  7             1  2  3  4  4  5  6  7  8  9 10    8  9 10 11 12 13 14    5  6  7  8  9 10 11 11 12 13 14 15 16 17   15 16 17 18 19 20 21   12 13 14 15 16 17 18 18 19 20 21 22 23 24   22 23 24 25 26 27 28   19 20 21 22 23 24 25 25 26 27 28 29 30 3129 30 31                  26 27 28 29 30        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  2       1  2  3  4  5  6             1  2  3  4  3  4  5  6  7  8  9    7  8  9 10 11 12 13    5  6  7  8  9 10 11 10 11 12 13 14 15 16   14 15 16 17 18 19 20   12 13 14 15 16 17 18 17 18 19 20 21 22 23   21 22 23 24 25 26 27   19 20 21 22 23 24 25 24 25 26 27 28 29 30   28 29 30               26 27 28 29 30 31 31 [jdoe@frazz jdoe]$ cal 12 1941     December 1941 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 [jdoe@frazz jdoe]$ 




Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net