Home / Linux  / 7 Methods to Find Files and Directories on a Linux

7 Methods to Find Files and Directories on a Linux

search files linux find command

In this post , here we are going to discuss that can search files and directories in the linux based system . The is best tool to perform a real time search in the linux file system to find the files .

To search files user must have read and execute permission on a directory to inspect its contents.

Find command have a large number of options that uses depend on type of file should be found.

General Syntax of find command is below and it usage is below in uses methods.

# find Search_Path  Options Expression

Search_Path   : This is the path where find will filter  the files or expression

Options :  This argument will use to customize our output as we needed.

Expression : This attribute is search for a file name and return on all results that are match.

Below are 7 different method to searching in Linux file system :

(1)Find Files  by Type ( -type option)

The –type option followed by given file type like regular file , directory , soft link file and block devices files.

# find /home –type d ( For Directory )

# find /bin  –type l ( For soft Link files)
# find  /dev –type  b  ( For Block device files )
# find /home –type f  ( For Regular files )

(2) Find Files by Name ( -name option)

Here is the –name option took after with file name will fetch  exact matches  given file name  . if we need to search any file which contain passwd  anywhere in the etc directory and all sub directory, we will execute below command.

#find /etc –name '*passwd*'

(3) Find Files for case –insensitive ( -iname option)

You want to ignore case in searching through find command like yo do not know the case , it could be lowercase , uppercase or any of them , you can run find command with –iname option.Syntax will be like below.This is called as case insensitive searching through find command.

# find / -iname ‘*passWD*’


(4) Find Files by user ( -user option) and ( -group option )

Through  –user and –group option find can also search files of the owner and group ownerships based. Now if you want to search those files which is owned by user username like techtransit in the home directory of techtransit user then you have to run below command for this.

# find  /home/techtransit -user techtransit

And if you want to look those files in home directory of user techtransit , which is owned by group techtransit . Run the below command.

# find –group techtransit

You can also user both parameter together like , as I have show .

# find  Search_path  -user username –group groupname

(5) Find Files by Permission ( -perm option)

Searching files by permission is little comple . The –perm ioption will be used to search through permission , it look for files with particular set of permissions.
Here we are using octal value of permission to search files .The below command will match any files which user has read read,write and execute permission and group member and other have read only access in the /etc directory.

# find /etc –perm 744

Now we are going to describe the – and / value.

‘-‘ we are using for at least permission match like to find files which owner or user has at least  read, write , group and other have at least write access.


# find /etc –perm -644

To search file which the user or group has read permission or others have at least  read read and write access.

# find /etc –perm /446

When we used / or – value in perm , the 0 works like a wild card , this means  having a permission at least nothing .

Example : Below command will find all files in /etc/ directory  where others have write permission .

# find /etc –perm -002

(6) Find Files by Size  ( -size option )

Files also can search according to the size  through below option.

Below command is for exact size match 25 megabyte  on root files system.

# find  / –size 25M

+ Sign in size parameter search all file which is  more than size define.

# find –size +25G

-Sign in search all files , which is less than size define.

#  find –size   -25G

(7) Find Files by Time ( –mmin option )

The mmin option is for search file that had their content changed at exactly the given time in the past.below command will search those files which has changed exact 20 min ago  in the etc directory.

# find /etc –mmin 20

+ and –  operand in front of the mmin  option will look for all files in the /etc/ that have been modified more than or less than given time.

A Linux Geek with Freelance Contributor, Server/ Cloud Administrator having experience in Open Source and Cloud Technologies.

Review overview


Time limit is exhausted. Please reload CAPTCHA.