Searching Files and Directories Quickly

You've learned how to list files with the ls command and change your working directory with the cd command. To find a specific file using only ls and cd, however, you must navigate slowly through directory trees, listing each directory, directories inside those directories, and so on, until you find the file you want. Searching with ls and cd is fine for a collection of two or three files, but how about a collection of a hundred files? A thousand? Eventually, all those filenames will begin to look the same.

Rather than search all day by hand, you can use the find and locate commands to find the location of your stray files more quickly.

Searching for Files with find

You can use the find command to search ...

Get SAMS Teach Yourself Red Hat® Fedora™ 4 Linux® All in One now with O’Reilly online learning.

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