Thursday, June 23, 2011

Unix Notes - Find a File

Related Posting: To find a string within a file list, see this post.

Find all the SQL (*.sql) files in the current directory:

find . -name '*.sql'

To hide any [access] errors, include 2>/dev/null at the end of the line.

find . -name '*.sql' 2>/dev/null

To list only files and avoid all directories:

find . -type f -name '*.sql' 2>/dev/null

Search all directories ('/' is the top level directory reference):

find / -type f -name '*.sql' 2>/dev/null

No comments: