Look up computer jargon in the Terminal

Nov 17, '04 08:42:00AM

Contributed by: MichaelBuckley

There's nothing that I hate more than reading a computer-related tutorial or book and being completely frustrated by my inability to understand the subject because I can't remember a few obscure tech terms, which the author liberally injects into his writing. In this regard, Wikipedia has become my new best friend. However, I have found cases where the Wikipedia entries for certain terms contain either too little or too much information on the subject. Furthermore, when traveling with my Powerbook, I often don't have access to the Internet.

The Jargon File contains a large number of the terms that I've needed to look up. For those of you unfamiliar with the Jargon File, there's a fairly good description over at Wikipedia. There is also command-line tool to display individual entries from the file, and it's fairly easy to install and use.

[robg adds: I got this running with only a couple of snags. Once installed and functional, here's an example of what you can see:

$ jarg zork
:Zork: /zork/, n.

   The second of the great early experiments in computer fantasy gaming;
   see  {ADVENT}.  Originally  written on MIT-DM during 1977-1979, later
   distributed  with  BSD  Unix  (as a patched, sourceless RT-11 FORTRAN
   binary;   see  {retrocomputing})  and  commercialized  as  `The  Zork
   Trilogy'  by  {Infocom}.  The  FORTRAN source was later rewritten for
   portability  and  released  to  Usenet under the name "Dungeon". Both
   FORTRAN "Dungeon" and translated C versions are available at many FTP
   sites;    the    commercial    Zork    trilogy    is   available   at
   http://www.ifarchive.org/.  See  also {grue}. You can play Zork via a
   Java Applet.
Read the rest of the hint for the how-to...]

First, you'll need the latest version of the Jargon File (4.4.7). Save this file to a location on the hard drive where it is unlikely to be removed or renamed. Next, save the jarg 2.4 source to the hard drive. This command-line program was actually written for DOS, but because the programmer was nice enough to block off DOS-specific code with ifdef statements, it will compile and run with no problems on OS X. You won't need to keep the source after you compile the program, but for convenience sake, it is best to save it to the same location as the Jargon file.

Now, enter the terminal and navigate to the directory containing jarg.c, and type the following:

  sudo gcc -o /usr/bin/jarg jarg.c
The program should compile within a few seconds without displaying any messages. If you are having trouble getting the program to compile, you can download a pre-compiled version from my web space. After you have the compiled version, it must be set up to recognize the Jargon File, like so:
  jarg -i jarg447.txt
This creates a file that jarg uses to quickly find and display entries. If you later wish to use a newer version of the Jargon File, or if you move the Jargon File, you will need to run jarg with the -i flag on the new file or location. For a description of how to use the program, simply type jarg at the command-line.

[robg adds: I compiled into my ~/bin directory without any errors. Once compiled, though, I was getting errors when trying to create the index. To get the index working, I had to both use sudo and also include the full path to the Jargon File:
  sudo jarg -i /Users/robg/bin/jarg447.txt
The second problem was that, even once I got the command above to work, the output indicated that it indexed 0 words, which I was pretty sure wasn't right :). A quick look at the Jargon File with vi found the problem: the file was populated with ^M characters instead of line breaks. In the directory where I stored the Jargon File, I ran this command:
  perl -pi -e 's/\r\n?/\n/g' jarg447.txt
That's from a comment to a really old hint about Mac vs. Unix line breaks, and it converts them all in one quick pass. After converting all the ^Ms, the index creation command worked, and I now have a fully functional jarg command.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=200411102322421