Monday, August 1, 2011

Ask Ars: how do I use the find command in a pipeline?

Ask Ars: how do I use the find command in a pipeline?:


In 1998, Ask Ars was an early feature of the newly launched Ars Technica. Now, as then, it's all about your questions and our community's answers. Each week, we'll dig into our question bag, provide our own take, then tap the wisdom of our readers. To submit your own question, see our helpful tips page.

Q: I know I can use the find command at the command line to locate files, but how do I use it with other commands to perform a real-world task? What's the difference between the -exec parameter and piping into xargs?

The find command is a standard utility on UNIX and Linux systems. It will recurse through directory structures and look for files that conform with the user's specified parameters. There are a number of different search operators that can be used together to achieve fine-grained file matching.

In this tutorial, I'll explain how to use the find command with several common search operators and then I'll show you some examples of how to use the find command in a pipeline.

Read the rest of this article...