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.*
Share
Categories
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
Hey we have Thai new year on 13-15 April too
April 13 2007 at 11:03 AM Report abuse Permalink rate up rate down ReplyYou 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.
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
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??
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!
Bad news: http://www.apple.com/hotnews/
April 12 2007 at 6:19 PM Report abuse Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- Altec Lansing Octiv Duo iDock for $48 + free shipping
- Used Apple iMac 17" Core 2 Duo 1.83GHz for $430 + $28 s&h
- Lounge Deluxe Stand for iPhone / iPod touch for $28 + $8 s&h
- Brookstone Surround-Sound Earbuds for $14 + $7 s&h
- Refurbished Skullcandy Tokidoki Smokin' Buds Mic'd Headset for $5 + $2 s&h
- Stitchway Backup Battery for iPod / iPhone for $5 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



6 Comments