How to Use find in Linux

310

In a recent Opensource.com article, Lewis Cowles introduced the find command.

find is one of the more powerful and flexible command-line programs in the daily toolbox, so it’s worth spending a little more time on it.

At a minimum, find takes a path to find things. For example:

find /

will find (and print) every file on the system. And since everything is a file, you will get a lot of output to sort through. This probably doesn’t help you find what you’re looking for. You can change the path argument to narrow things down a bit, but it’s still not really any more helpful than using the ls command. So you need to think about what you’re trying to locate.

Perhaps you want to find all the JPEG files in your home directory. The -name argument allows you to restrict your results to files that match the given pattern.

Read more at OpenSource.com