Advertisement

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.*