O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

look

Synopsis

look [options] string [file]

Looks through a sorted file and prints all lines that begin with string. Words may be up to 256 characters long. This program is potentially faster than fgrep because it relies on the file being sorted already, and can thus do a binary search through the file, instead of reading it sequentially from beginning to end.

With no file, look searches /usr/share/dict/words(the spelling dictionary) with options -df. This can be a handy way to look up a word in the dictionary if you only know the start of the word. If you can't remember how to spell "carburetor," try look carbur to see the 12 words in the dictionary that start "carbur."

Options

-d

Use dictionary order. Only letters, digits, spaces, and tabs are used in comparisons.

-f

Fold case; ignore case distinctions in comparisons.

-t char

Use char as the termination character, i.e., ignore all characters to the right of char.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required