Skip to Content

Terminal Tip: Accessing built-in calendars

On Sunday, I posted about the built-in calendars found in /usr/share/calendar. These calendars include listings of events from around the world and for religions, e.g. calendar.history and calendar.christian. Today, I thought I'd share some ways to access those calendars from the command line.

On pretty much any version of Mac OS X, you can use the built-in calendar command to list the events of the day. The -f flag allows you to select which calendar you want to access. The calendar.world file references all the other English-language calendars.

% calendar -f /usr/share/calendar/calendar.world
Apr 13 Thomas Jefferson born, 1743
Apr 12 Confederate troops fire first shots of Civil War at Ft Sumter, 1861
Apr 12 Space Shuttle Columbia launched, 1981
Apr 12 Yuri Gagarin becomes the first man in space, 1961
Apr 13 Laotian New Year (3 days) in Laos
Apr 13 National Day in Chad
Apr 13 Songkron Day in Thailand
and so forth...
%

You can embed this command into your startup files like ~/.bashrc so the events of the day display whenever you open a new shell. Unfortunately, the calendar command does not seem to work properly on my Intel-based Mac Mini; Mike reports that it works just fine on his MacBook Pro. If your Intel Mac is balking at the calendar command, you can use grep as a workaround: grep `date +%m/%d` /usr/share/calendar/calendar.*



Categories

Terminal Tips

On Sunday, I posted about the built-in calendars found in /usr/share/calendar. These calendars include listings of events from around the...
 

Add a Comment

*0 / 3000 Character Maximum

6 Comments

Filter by:
tk719

Hey we have Thai new year on 13-15 April too

April 13 2007 at 11:03 AM Report abuse rate up rate down Reply
Cranky McGuy

You should note that the XCode toolset needs to be installed in order for calendar to work. Otherwise it gets cpp errors since cpp isn't installed.

Great tip, though. And I had no idea about the cal command. Thanks, Mark. Now I've added:

echo ""
cal
calendar -f /usr/share/calendar/calendar.usholiday
echo ""

to the bottom of my .bash_profile so I see the calendar and upcoming holiday every time I open a shell.

April 13 2007 at 5:12 AM Report abuse rate up rate down Reply
mark.hilstad

My favorite calendar command:

$ 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

April 13 2007 at 1:35 AM Report abuse rate up rate down Reply
MurphyMac

That's really cool.
Anyone know how to redirect the output from the cal command so it can be pasted into windowed apps without getting all askew??

April 12 2007 at 6:41 PM Report abuse rate up rate down Reply
Sam

I am using this with geektool since you posted the tip last week.

Here is what I am using:

grep `date +%m/%d` /usr/share/calendar/calendar.history

That will show what happened on whatever today is.

Cheers!

April 12 2007 at 6:31 PM Report abuse rate up rate down Reply
Dina

Bad news: http://www.apple.com/hotnews/

April 12 2007 at 6:19 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.