Chapter 10. The find
Command
In the last chapter, we covered commands that let you search for files (locate
) and data within files (grep
). The third command in the powerful triumvirate is find
. While locate
searches a database for files, which makes it fast but dependent upon a constantly updated database, find
searches for files on the fly using criteria that you specify. Since find
has to parse through your file structure, it’s much slower than locate
, but you can do things with find
that aren’t possible with locate
.
Throughout this chapter, we look for files on an external hard drive that contains music mounted at /media/music
. You can see that find
allows us to slice and dice the files in a variety of ways.
Find Files by Name
find -name
find
Get Linux: Phrasebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.