O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding files and file listing

find is one of the great utilities in the UNIX/Linux command-line toolbox. It is a very useful command for shell scripts, but most people do not use it effectively due to the lack of understanding. This recipe deals with most of the use cases of find and how it can be used to solve problems of different criterions.

Getting ready

The find command uses the following strategy: find descends through a hierarchy of files, matches the files that meet specified criteria, and performs some actions. Let's go through different use cases of find and the basic usages.

How to do it...

In order to list all the files and folders from the current directory to the descending child directories, use the following syntax:

$ find base_path ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required