locate program can find a file based solely on its name, the
find program searches a given directory (and its subdirectories) for files based on a variety of attributes. We’re going to spend a lot of time with
find because it has a bunch of interesting features that we will see again and again when we start to cover programming concepts in later chapters.
In its simplest use,
find is given one or more names of directories to search. For example, it can produce a list of our home directory:
On most active user accounts, this will produce a large list. Since the list is sent to standard output, we can pipe the list into other programs. Let’s use
wc to count the number of files: