Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A command-line calendar tool UNIX
With all the desktop calendars that are available, we sometimes forget the most basic and speedy little calendar app that is free in OS X.

In the Terminal, just type cal at the prompt. It will bring up a nice little calendar. Read the man pages (man cal) for other great options.
    •    
  • Currently 2.17 / 5
  You rated: 2 / 5 (6 votes cast)
 
[8,493 views]  

A command-line calendar tool | 3 comments | Create New Account
Click here to return to the 'A command-line calendar tool' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Great tool
Authored by: babbage on Jan 16, '02 11:44:52AM
By default, cal just shows the current month, but you can optionally give it a year -- in which case you get (quel surprise) the whole year -- or a month & year (you figure it out). It's fairly easy to script this so that you can see e.g. this month & next every time you log in. At one point I had a little web page wrapped around cal's output that highlighted holidays and weekends and so on, and it wasn't hard to do. Here's some sample output:
  [localhost Wed 11:39:25am Explorer]% cal
January 2002
S M Tu W Th F S
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

[localhost Wed 11:39:28am Explorer]% cal 1 2002
January 2002
S M Tu W Th F S
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

[localhost Wed 11:39:33am Explorer]% cal 9 1752
September 1752
S M Tu W Th F S
1 2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
See if you can spot & interpret what's funny with that last one without having to go to the man pages... :)

[ Reply to This | # ]
Great tool
Authored by: harttj on Jan 25, '02 11:09:51PM

Where are the days 3 to 14? Is something wrong with my computer?



[ Reply to This | # ]
Great tool
Authored by: babbage on Jul 03, '04 07:13:22PM
Where are the days 3 to 14? Is something wrong with my computer?

I'm answering this question two years late, but oh well :-)

Check out the man page for cal for an answer:

CAL(1)                    BSD General Commands Manual                   CAL(1)

NAME
     cal - displays a calendar

SYNOPSIS
     cal [-jy] [[month]  year]

DESCRIPTION
     cal displays a simple calendar.  If arguments are not specified, the cur-
     rent month is displayed.  The options are as follows:

     -j      Display julian dates (days one-based, numbered from January 1).

     -y      Display a calendar for the current year.

     A single parameter specifies the year (1 - 9999) to be displayed; note
     the year must be fully specified: ``cal 89'' will not display a calendar
     for 1989.  Two parameters denote the month (1 - 12) and year.  If no
     parameters are specified, the current month's calendar is displayed.

     A year starts on Jan 1.

     The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd
     of September.  By this time, most countries had recognized the reforma-
     tion (although a few did not recognize it until the early 1900's.)  Ten
     days following that date were eliminated by the reformation, so the cal-
     endar for that month is a bit unusual.

HISTORY
     A cal command appeared in Version 6 AT&T UNIX.

BSD                             April 28, 1995                             BSD

So, the calendar for September 1752 is broken on purpose :-)

---
--
DO NOT LEAVE IT IS NOT REAL

[ Reply to This | # ]