cURL is a command line tool for transferring files and data using URL syntax. It supports a lot of protocols such as DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.

In this example we are going to use cURL as a dictionary lookup tool.



First, you need to install the cURL package:

sudo apt-get install curl

The Dictionary Server Protocol (DICT) is a TCP protocol that enables a user to access dictionary definitions from a set of dictionary databases.

To search the meaning of any word, simply type this command in a terminal window:

curl dict://dict.org/lookup:computer

This command will output the following lines:

151 "Computer" gcide "The Collaborative International Dictionary of English v.0.48"
Computer \Com*put"er\ (k[o^]m*p[=u]t"[~e]r), n.
1. One who computes.

2. (Computers) an electronic device for performing
calculations automatically. It consists of a clock to
provide voltage pulses to synchronize the operations of
the devices within the computer, a central processing
unit, where the arithmetical and logical operations are
performed on data, a random-access memory, where the
programs and data are stored for rapid access, devices to
input data and output results, and various other
peripheral devices of widely varied function, as well as
circuitry to support the main operations.

As you can see in the example above, the definition of the word "computer" is taken from The Collaborative International Dictionary Of English. To see the available databases, run this command:

curl dict://dict.org/show:db

For example, if you want to show results only from the WordNet 3.0 dictionary, use this command:

curl dict://dict.org/lookup:YOURWORD:wn

Advanced use:

You can use strategies to narrow the search results:

curl dict://dict.org/m:SUFFIX:wn:suffix

This command will return a list of words that contain the suffix SUFFIX. Similarly, you can use the PREFIX strategy to get a list of words that begin with a prefix of your choice. To get a list of the available strategies, use this command:

curl dict://dict.org/show:strat

Comments