Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Useful reference info at your OS X fingertips System
Want to know the airport code for Newark, NJ? Need to find out where the 90210 zip code is? How about the international dialing code for Papua New Guinea? Or the significance of giving a Peach Blossom as a gift? Need to covert liters to gallons?

Mac OS X knows all of these things and more! Check out the /usr/share/misc directory. There you'll find a bunch of text files with all of these reference guides and more. To search for information, use the grep command. For example:
  % grep 90210 /usr/share/misc/zipcodes
This returns:
90210:Beverly Hills, CA
If you're searching for text, remember that grep is case sensitive unless you include the -i option to ignore case (grep -i text_to_find). Want to find all references to Denver in the entire directory? Try:
  % grep -i Denver /usr/share/misc/*
This returns the airport code from "airport", the area code from "na.phone", and the zip codes from "zipcode" for all entries which contain "Denver" or "denver".

Granted all of this information can be found on the net in various places, but it's much faster to use the local reference. The web has the advantage of more current data, of course, but the local file searches are fast!
    •    
  • Currently 2.00 / 5
  You rated: 1 / 5 (2 votes cast)
 
[5,421 views]  

Useful reference info at your OS X fingertips | 18 comments | Create New Account
Click here to return to the 'Useful reference info at your OS X fingertips' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Information is out dated
Authored by: nulldev on Aug 05, '02 09:24:41AM

It's nice to have that information but it's out dated. Is there any way to get updated files?



[ Reply to This | # ]
Information is out dated
Authored by: jsewell on Aug 05, '02 09:43:18AM
I think you can find the newer versions of these files at: http://www.openbsd.org/cgi-bin/cvsweb/src/share/misc/ -Jason Sewell

[ Reply to This | # ]
Information is out dated
Authored by: bluehz on Aug 05, '02 05:01:50PM
If you want to get fancy - you can create a cron tas to sync against the cvs source each week or something to keep it up to date. I just discovered how to use the cvs function - so there may be better ways of doing this (cvs pros - please chime in here!): You could create file and paste the follwing in it, save it and change to executable. Then your cron job could run the task. Unfortunately the task asks you for a login password each time and I have not fig out a way to encode that into the script.The password is anoncvs when asked.
#!/bin/sh cd /path/to/tmp/dir cvs -d:pserver:anoncvs@anoncvs1.usa.openbsd.org:/cvs login cvs -z3 -d:pserver:anoncvs@anoncvs1.usa.openbsd.org:/cvs co src/share/misc
You could download directly to your /usr/share/misc but I am not that brave so I d/l to a tmp dir and move manually

[ Reply to This | # ]
.cvspass
Authored by: vajonez on Aug 05, '02 11:08:48PM

You only need to login once (assuming you don't "cvs logout"). CVS stores the trivially encoded password associated with each cvsroot (the stuff you listed after the -d in the commands above) in ~/.cvspass. CVS also keeps track of which cvsroot corresponds to each checked out directory in <checked_out_dir>/CVS/Root.

In a nutshell, login once by hand and chechout the files you are interested in, then use "cvs update", either run by hand or via a cron job, to keep the files current.



[ Reply to This | # ]
Information is out dated
Authored by: cybermill on Aug 08, '02 02:07:17AM

I tried the script and got the following, any ideas?

(Logging in to anoncvs@anoncvs1.usa.openbsd.org)
CVS password:
cvs [login aborted]: authorization failed: server anoncvs1.usa.openbsd.org rejected access
cvs checkout: cannot find password
cvs [checkout aborted]: use "cvs login" to log in first



[ Reply to This | # ]
Information is out dated
Authored by: vajonez on Aug 09, '02 01:34:04AM

cvs login is an interactive command and should not be in the script.

Remove the login command from the script and execute it once by hand. CVS will store the "encrypted" password for that cvsroot in ~/.cvspass. CVS will consult this file for future operations using that root.



[ Reply to This | # ]
Web App Integration
Authored by: Maran on Aug 05, '02 09:28:21AM

This makes me wonder if I couldn't use these files from my php or perl web applications to do dynamic zip code / city lookups without having to purchase access to a database...

Has anyone tried this?



[ Reply to This | # ]
Web App Integration
Authored by: bknabel on Aug 05, '02 11:24:55AM

The zipcodes file will allow you to easily find a zip code for a given city. But the reverse search won't work - a city like Chicago will have many zip codes and given the information in the file you can't resolve which zip code goes with a specified address.



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: alajuela on Aug 05, '02 02:09:02PM

What's the point of having all this stuff if there isn't an easier way to get at it? No flames, please, I love the Terminal, but greping for stuff is not tricial, and certainly not a pitch for the Switch campaign

Any thoughts on why this stuff is there?



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: Anonymous on Aug 05, '02 02:16:03PM

maybe they're used while configuring the OS installation?
ever wonder how the Mac OS X installer did know your phone number or postal code wasn't right!?



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: bluehz on Aug 05, '02 04:13:41PM

I was just wondering the same thing. What is the actual purpose of these files in the whole scheme of things?



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: dannyobrien on Aug 05, '02 04:48:15PM

They're part of the standard BSD distribution. BSD is the
open source bit of the MacOS X operating system.

If you find that their values are out of date, feel free to correct them
and send the corrected file to either the Darwin maintainers, or NetBSD,
which looks to be where these files came from.

More useful BSD data files in /usr/share/dict/ including a list of
proper names, and a fairly large word list, based on Websters.



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: Glanz on Aug 06, '02 08:09:32AM

I use BBEdit Lite quite often for files like that by using the "Open//hidden" option. This is convenient because you do not have to leave the "show hidden files" option active to search the directories. It's actually faster than the terminal because of the GUI. Any number of text editors will do the job, but I find BBEdit the fastest.



[ Reply to This | # ]
re: bbedit too slow
Authored by: dm2243 on Aug 06, '02 04:28:50PM

for me, the "open hidden" feature takes forever. much faster is this:

% locate somefile
% bbedit path_to/somefile

assuming one's locate db is up-to-date.



[ Reply to This | # ]
How about integration into Sherlock/Watson?
Authored by: aranor on Aug 25, '02 08:00:02PM

You can actually open hidden directories in the finder with the Go To Folder command (Cmd-` in MacOS 10.1.x and Cmd-Shift-G in Jaguar). Oh, and you can tab-complete in that editfield as well. Nifty.



[ Reply to This | # ]
MySQL
Authored by: jecwobble on Aug 05, '02 04:44:42PM
Any thoughts on the value of parsing these files into tables in MySQL? Know of any other general information that's maintained on the web for free? Jason Sewell offered http://www.openbsd.org/cgi-bin/cvsweb/src/share/misc/ as a source for these files. Maybe write a script that checks for new versions and updates automatically?

[ Reply to This | # ]
Cocoa program to find codes
Authored by: andrewz on Aug 06, '02 02:45:41PM
I wrote a little Cocoa program called Code Finder to quickly find codes in the /usr/share/misc directory. You can try it at:

http://homepage.mac.com/~azc/CodeFinder.dmg



[ Reply to This | # ]
Useful reference info at your OS X fingertips
Authored by: mjones1040 on Nov 20, '03 11:39:53AM

This hint no longer works unless you manually download the reference files and place them in /usr/share/misc. The following files can be found at http://www.openbsd.org/cgi-bin/cvsweb/src/share/misc/

"airport", "inter.phone", "na.phone", and "zipcodes"

There is also a nice GUI for these files available at http://homepage.mac.com/azc/CodeFinder/



[ Reply to This | # ]