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

Quickly define words in the Terminal UNIX
Add the following alias to your aliases.mine file to have an on-call dictionary at your fingertips:
alias dict 'curl dict://dict.org/d:\!*'
Now to look up a word, just type dict word_to_define.

[Editor's note: There's at least one service (OmniDictionary) which will return the definition of a selected word if you prefer the GUI for your dictionary browsing ... but this is quite nice when you don't want to touch the mouse or the menu to define a word. Note that I have substantially (completely?) rewritten what Carthag submitted ... primarily because, although it was fun reading an IRC transcript, it really didn't fit the layout of the macosxhints page all that well! ;-)]
    •    
  • Currently 3.00 / 5
  You rated: 4 / 5 (4 votes cast)
 
[7,094 views]  

Quickly define words in the Terminal | 4 comments | Create New Account
Click here to return to the 'Quickly define words in the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Nice hint, lets remove that extra stuff
Authored by: geohar on Apr 11, '02 05:45:13AM

I get numbered output from the server saying ok, miranda....

If I redefine the alias as

alias dict "curl -s 'dict://dict.org/d:\!*' | egrep -v '^220.*|^250.*|^150.*|^221.*'"

then I get the extraneous server messages removed.

Very cool tip though



[ Reply to This | # ]
Nice hint, lets remove that extra stuff
Authored by: vonleigh on Apr 11, '02 06:42:48AM

Hello,

I'm a unix newby, so pardon my ignorance if there is a much better way of doing this. I like the tip, but I didn't want the result to fill the screen and then have to go back and read what it was, so I decided to pipe it to more:

alias dict 'curl dict://dict.org/d:\!*|more'

This way it displays one page at a time. Just went back to the tip and this response above was added, great idea! More could be added to the above post also (just append a |more). Although I'd recommend not eliminating 150 from the result since it displays how many results were found. So:

alias dict "curl -s 'dict://dict.org/d:\!*' | egrep -v '^220.*|^250.*|^221.*' | more"

One question though, how do you make this stick between terminal sessions? I remember something about aliases.mine but that's it.

Vonleigh



[ Reply to This | # ]
aliases.mine
Authored by: robg on Apr 11, '02 09:21:27AM

There are a number of hints here about it; try searching on "aliases.mine" or just "alias" sometime. In a nutshell, though, add the "alias" command to a file named "alias.mine" located in ~/Library/init/tcsh (create those directories if you need to), save the file, close the terminal window and open a new one, and you should be good to go!

-rob.



[ Reply to This | # ]
Binary command of the same name
Authored by: babbage on Apr 11, '02 12:20:08PM
If you have Fink installed, the Fink project has ported a nice little dict command that is very versatile:
% sudo fink -y install dict
[give fink time to download, build, and install for you]

% rehash

% dict --help
dict 1.5.5/rf on Darwin 5.3
Copyright 1997, 1998 Rickard E. Faith (faith@cs.unc.edu)
-h --host specify server
-p --port specify port
-d --database select a database to search
-m --match match instead of define
-s --strategy strategy for matching or defining
-c --config specify configuration file
-C --nocorrect disable attempted spelling correction
-D --dbs show available databases
-S --strats show available search strategies
-H --serverhelp show server help
-i --info show information about a database
-I --serverinfo show information about the server
-a --noauth disable authentication
-u --user username for authentication
-k --key shared secret for authentication
-V --version display version information
-L --license display copyright and license information
--help display this help
-v --verbose be verbose
-r --raw trace raw transaction
-P --pager program specify program to use as pager (- for none)
--debug set debugging flag
--html output HTML format
--pipesize specify buffer size for pipelining (256)
--client additional text for client command

% dict zeitgeist
1 definition found

From Webster's Revised Unabridged Dictionary (1913) [web1913]:

Zeitgeist Zeit"geist`, n. [G.; zeit time + geist spirit. See
{Tide}, n.; {Ghost}, n.]
The spirit of the time; the general intellectual and moral
state or temper characteristic of any period of time.

% dict -D
Databases available:
elements Elements database 20001107
web1913 Webster's Revised Unabridged Dictionary (1913)
wn WordNet (r) 1.6
gazetteer U.S. Gazetteer (1990)
jargon Jargon File (4.2.3, 23 NOV 2000)
foldoc The Free On-line Dictionary of Computing (13 Mar 01)
easton Easton's 1897 Bible Dictionary
hitchcock Hitchcock's Bible Names Dictionary (late 1800's)
devils THE DEVIL'S DICTIONARY ((C)1911 Released April 15 1993)
world95 The CIA World Factbook (1995)
vera V.E.R.A. -- Virtual Entity of Relevant Acronyms 13 March 2001
Etc. Not that there's anything wrong with the alias hack -- it's a very good use of the command actually -- but this is a cool little program that does much the same thing, much more dynamically. Try it! :-)

[ Reply to This | # ]