For beginners who dealings first time with a Linux machine face one problem, how to find files and folders they looking for.
In this guide we will cover how to use find command with examples. This will help you to find files and folders on your Linux using bash shell.


Finding files by Name:


Easiest way to find files is by name:

# find /path/to/target/directory  -name "fileName" 

Let’s take one example:

Suppose you remember only the file name which is “”, but forget the location of file. In this condition I will use find command and search required file in whole system by giving the location “/” (mean root of file system).

See the command in action:

# find / -name "" 

Search Result:


The result of above command is showing I have this file on multiple location, command found this file on “/” (root) and other copy is in home directory of user haider which is /home/haider

Note: This command dealing all the keywords as case sensitive, meaning a search for is different than

In case, you forget the name exactly if it was in capital words or not.

Here is command to search files, but ignore the case of the filename.

# find / -iname "" 

Search Result:


Now it found two files, the difference is only upper and lower character “B” in file name.

Find something by specifying type

Common types are:

  1. d: directory
  2. f: regular file
  3. b: block device
  4. l: symbolic link

< class="post-text">For example if you want to find directory called haider. you will use following command:

# find / -type d -iname "haider"



By Extensions

For instance, you want to search all files ending with .conf from /etc/ directory.

see command:

# find /etc -type f -name "*.conf"

Sample Output:


Next: Search Text within Files in Linux

If you like this Post, please give us your valuable feedback by pressing Vote Up / Vote Down Button. Thanks.


Similar Posts