#19 Locating Files by Filename

One command that's quite useful on Linux systems, but isn't always present on other Unixes, is locate, which searches a prebuilt database of filenames for the specified regular expression. Ever want to quickly find the location of the master .cshrc file? Here's how that's done with locate:

$ locate .cshrc
/.Trashes/501/Previous Systems/private/etc/csh.cshrc
/OS9 Snapshot/Staging Archive/:home/taylor/.cshrc

You can see that the master .cshrc file is in the /private/etc directory on this Mac OS X system. The locate system sees every file on the disk when building its internal file index, whether the file ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.