Sunday, 1 February 2015

How to use find command in linux

Intro
Find utility searches for files in a directory. Basically files can be found under Linux in many different ways. Using the find utility is one of the best ways to find files. The find utility has a huge number of parameters which can be set so that Linux finds exactly those files that you were searching for.

Syntax
find  where_to_look  criteria  which_file_want_to_search

Example
$ find / -name report 2>/dev/null

/ Start searching from the root directory
-name Given search text is the filename rather than any other attribute of a file
report File name for which we are looking

Note
2> /dev/null is not related to find utility. Here, 2 indicates the error stream in Linux, and /dev/null is the device where anything you send simply disappears i.e. Above example discard all error messages.

No comments:

Post a Comment