Unix cal command: a key part of my calendaring solution

I noticed both Tim Bray and John Roberts‘ recent ruminations on the perfect calendar solution, and while I don’t have the answer, in thinking about it I realized that I have a quirky calendar-related habit that has stuck with me for over a decade, throughout all my own various experiments with Palm Desktop, Outlook, iCal, etc. On a daily basis, I use the Unix cal command to help schedule my life. I don’t know what I would do without it.

When looking at broad swaths of time (say, a whole year), nothing beats the good ol’ cal command for quickly giving you a lay of the land when you’re making scheduling decisions far in advance (for conferences, vacations, etc.) Just type “cal 2006” and you’ve got the whole year laid out before you:

Of course, the Unix cal command is a read-only environment, so once I determine whether a particular date works for whatever I’m doing, I have to put my commitment on a writeable calendar somewhere — but I still couldn’t do without my cal.

Anyone else out there do this?

15 thoughts on “Unix cal command: a key part of my calendaring solution

  1. I once inherited a bit of Web code that shelled out to run cal and parsed the result in order to build a calendar page for a given month. I was surprised at how well it worked (and how much code I had to write to do the same thing without shelling out.)

    Calendars are hard, and cal does them well.

  2. Now that you mention it, I’m pretty sure I wrote some code a long time ago that did just that (i.e. the shell out to cal and parsing).

    I’m not a C programmer (and not that interested in become one at this point), but I’m guessing the cal source code is either amazingly elegant or the hack to beat all hacks.

  3. I didn’t know the cal command even existed… Never done much in Unix. That’s one reason I read other people’s blogs on a regualr basis!

    Works great in OS X terminal. I noticed that to view 2006 data you need to say cal 07… I had to type cal 06 twice to realize i was looking at ’05 data. This of course makes sense but it did surprise me the first time.

  4. Hey Chad,

    I have this calendar concept rolling around in my head… I’ve been talking with bradley and a ton of others about it. I’d like to run it by you when you have a moment, I’ll ping ya soon.

  5. Cal is very useful. I like it too.
    If you need a cli program for dates and appointments
    you can use ‘when’. Perhaps now you don’t need separate paper calendars anymore.


    Another program i can recommend is DevTodo.
    It has nothing to do with calendars, but i find it extremly useful.

    Think of you have to clean up a directory.
    When you enter it – DevTodo can remember you to do it!
    It saves directory dependent todo lists.


  6. I run GeekTool on OS X. This allows me to run the output of terminal commands as part of the “desktop background”. Also, I disabled all Finder Icons on the desktop background using a utility called “Cocktail”. You can then have some logs to always run on your desktop, and also the output of “cal -y”. I would like to use a more modern version that also has the -m option (my weeks start on Monday), and Apple only includes an 1994 version of the cal command.

  7. Another useful one I use in Ubuntu or it just comes with gnome I think…

    zenity –calendar

    pops up a calendar for the current month but you can click around by month and by year.

  8. Why in AIX does my cal 2007 command only give me my calendar with 2 months across instead of 3. I want it 3 months across. Can anyone help?

  9. I love the Unix “cal” command. It’s so convenient when I want to check what day of the week a specific day falls on. (I wish there was a Windows equivalent that was just as easy to use.)

    Recently I learned how to mentally calculate the day of the week for any date since 1800. When I come across a date in a book or article I’m reading, I like to figure out the day of the week it falls on, and then use the “cal” command to check my answer.

    (Incidentally, I use John Conway’s “Doomsday Rule” to mentally calculate the day of the week of any given date. If you’re interested in checking it out, you can look up “Doomsday Rule” on Wikipedia.)

  10. I am trying to port this to windows cmd shell and to dos 32-bit today. while there are some old ports to dos, they do not run well and get truncated.

Comments are closed.