MacのSpotlightを使えば、単に名前が一致するファイルやフォルダやアプリケーションなどが検索できるほか、中身が一致するものもあわせて検索できてとても便利です。普通画面右上の虫眼鏡アイコンをクリックして実行しますが、mdfind というコマンドを使えばコマンドラインから実行することもできるみたいです。
例えばファイル名を対象に検索する場合以下のようにして実行します。
$ mdfind -name gcc-4.2 /usr/llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/llvm-gcc-4.2 /usr/bin/gcc-4.2 /usr/bin/i686-apple-darwin11-gcc-4.2.1 /usr/share/man/man1/gcc-4.2.1
manページも準備されています。
mdfind(1) BSD General Commands Manual mdfind(1) NAME mdfind -- finds files matching a given query SYNOPSIS mdfind [-live] [-count] [-onlyin directory] [-name fileName] query DESCRIPTION The mdfind command consults the central metadata store and returns a list of files that match the given metadata query. The query can be a string or a query expression. The following options are available: -0 Prints an ASCII NUL character after each result path. This is useful when used in conjunction with xargs -0. -live Causes the mdfind command to provide live-updates to the number of files matching the query. When an update causes the query results to change the number of matches is updated. The find can be cancelled by typing ctrl-C. -count Causes the mdfind command to output the total number of matches, instead of the path to the matching items. -onlyin dir Limit the scope of the search to the directory specified. -name fileName Searches for matching file names only. -literal Force the provided query string to be taken as a literal query string, without interpretation. -interpret Force the provided query string to be interpreted as if the user had typed the string into the Spotlight menu. For example, the string "search" would produce the following query string: (* = search* cdw || kMDItemTextContent = search* cdw)
オプションを覚えなくても、locateがわりに使えば便利そうですね。