Cool Commands
If all you knew of Unix was what you’d read thus far in this chapter, you might assume that it’s a pretty utilitarian, programmery sort of language. And that would be a fair assumption. In truth, though, lurking deep within its exhilarating code, there’s actually a fun, hidden side just waiting to bust loose.
View the Hidden Lord of the Rings Timeline
Your Mac OS X system contains many hidden tools and features, but it also contains its share of timewasters. Deep in the bowels of Mac OS X resides a list of major world events and the days on which they occurred. And within this list is a chronology of the steps that Frodo, Gandalf, and the others took in the Lord of the Rings. (No kidding.) To gaze at this timeline, run the following:
cat /usr/share/calendar/calendar.history | grep "LOTR"
You’ll see a list that begins like this:
01/05 Fellowship enters Moria (LOTR) 01/09 Fellowship reaches Lorien (LOTR) 01/17 Passing of Gandalf (LOTR) 02/07 Fellowship leaves Lorien (LOTR) 02/17 Death of Boromir (LOTR)
If you’re curious, and want to see the rest of the historical event list, run this command:
cat /usr/share/calendar/calendar.history | more
The command above is sent through the more pager so you don’t see the entire span of history pass before your eyes in a split second. Press the Space bar to see more (get it?), and press q when you’ve finished and want to quit the pager.
Checking Dates
Unix also has a handy-dandy calendar command, cal. It’s ideal for times when you’re in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access