Find command in Linux
find command in linux

Find command in Linux

find command in Linux is the widely used open-source operating system in the fast-growing IT sector. Its most frequently used and significant feature is Linux Find Command in Unix-type operating systems. Linux Find Command is employed to search the files in a directory from the command line. This Linux command facilitates the system administrator to find out and organize files. It tends to be utilized to find files dependent on different search measures like approvals, user ownership, type of file, change in date/time, size, classification of extension, and so forth.

Here in this post, we will provide you with some basic but most important tricks so that you can learn “How to use the find command along with various preferences that it supports?”

You Can Also see this

Best Hosting plan

Most Important command in Linux

What is Find Command in Linux?

The Find Command is quite possibly the most incredible method in the Linux Operating system which helps in the administration of files and documents. It looks for documents, directories and files on the basis of a directory progressive system dependent on the command given by the user and can perform on user-determined activity if the correct match is found.

Find command also helps the users in order to search for directories and files based on various factors such as permissions, date, type, size, ownership, and some more. This command can also be utilized with other instruments such as grep or sed.

The adopted and basic structure of Find Command

find [path] [options] [expression]

The Options signify regulating the method of symbolic links, troubleshooting options Switch, and procedure for optimization. 

The Path… Implies the opening directory or a group of directories where the find command will look through the files. 

The Expression attribute is composed of actions, options, and various search patterns separated by administrators.

Find Files by Name 

Searching for the file using its name is presumably the most well-known utilization of the find command. If you want to find a file by its name, you need to use the – name option first and then using the name of the file you are looking for.

If you are looking for a file listed as simi.pdf in the /etc/simi directory, in this case, you would try the given command:

find /var -type f -name simi

Search File by name

If the user wants to operate a case-insensitive finding site the -name option with -iname

find /var -type f -name SimiTech

find file by name case insensitive

Find Files Using Extension

There are times where we are stuck in a condition in which we have to find multiple files with various extensions.

But Linux is filled with several utilities that will help to search or locate files within the file system using many filenames or files with distinct extensions.

Recognizing that you need to find out all files in the current directory with .sh and .txt files expansions, you can easily do this by performing the command underneath:

# find . -type f \( -name “*.sh” -o -name “*.txt” \)

Understanding of the command described above:

  1. . implies the current or present directory.
  1. -type attribute is used to define the type of file and here, we are looking for regular or some basic files as depicted by f
  1. -name action is added here to indicate a pattern of search while in this case, it is the file extensions.
  1. -o implies “OR

It is suggested that users should enclose the file extensions in brackets, and similarly, it can utilize the \ (backslash) escape character as in the find command.

Find Files by Modification Time

If you require to search the files by modification time then in this scenario you can use the -mtime alternative and then the number of days to search for. Remember that the numbers may be positive or negative values. A negative number associated with less than, so -1 will search for the files modified in the last 24 hours. Likewise, a positive number means more than, that’s why +1 will search files modified in more than 24 hours or completion of one day.

#find /home -type f -name “*.doc” -mtime -15

#find /home -type f -name “*.doc” -mtime +15

With the plus (+) and minus (-) signs, you can see the files changed in the find command of Linux in more or fewer days.

Find Files by Type

Occasionally, you want to look out for certain types of files that may be directories, regular files, or symbol links. Everything is a file in Linux, if you want to find the files on the basis of their type, choose for the -type action and the given descriptors to determine the file type: 

f: Indicates a Regular or Basic File

d: Implies Directory

l: Represents the Symbolic Link

c: Means Character Tools

b: Depicts Block Tools

p: Named Pipe (FIFO)

s: Represents the Socket

Let’s take an example for better understanding,

With the help of Linux Find Command, we can find all directories in the existing working directory.

The command we will give:

#find . -type d

Find Files by Size

In Linux, there are times when some files take up excess storage in your drives and you have no idea how to find them. To make some space for your drives to perform faster, we employ the Find command. It is possible to find files depending upon the file size, use the -size option along with the size standards. Use the subsequent suffixes given below to indicate the size of the file:

  • b: 512-byte blocks (default)
  • c: bytes
  • w: two-byte words
  • k: Kilobytes
  • M: Megabytes
  • G: Gigabytes

Let’s take an example of how Linux Find Command works on the basis of file size

You can Also See

Best Harddisk

Best Headphone

CCTV camera

find file by size in linux

The given find command will search all the files of precisely 100 bytes in the /etc directory:

find /etc -type f -size 100c

find file by byte in linux

It should be noted here that the find command also enables you to locate the files that are less or greater than a defined size.

#find . -type f -size 10k

find file by kilobyte size

In the above-provided find command, it is given that the searching was done for all files that are less than 10k in the /etc directory you can also search within the current working directory.

You may be able to identify the subtraction (-) symbol followed by the submitted size value that needs to find.

#find . -type f -size -10M

If the users need to find the files with a size greater than an MB, then, in this case, it is provided to add the plus (+) symbol in the command.

#find . -type f -size +10M

Using this way, users can also search for files that show nearby size ranges. In the given command, users will be able to search all the files in the range from 10 to 500MB.


#find . -type f -size +1M -size 2M

Find Files by Permissions

When the files are of great importance just like for security audit reasons, then in these particular conditions the Linux find command is helpful to find files with certain permissions.

The -perm option in the command permits you to look out for files that depend only on the file permissions.

1 – (x) Implies Executable Permission

2 – (w) Represents Write Permission

4 – (r) Indicates Read Permission

If a demanded file has “rwx” then it will have 4+2+1=7 

#find /home -type f -perm 755


If a file includes “rx” it will be 4+1=5

In the Linux Find Command for Permission, we use the following prefixes.

  • Slash (/)  in the command works as the prefix, which means that the minimum one category which may be user, group, or others should have at least the respective bits set to match a file.
  • minus( -) is used as the prefix which means that at least the specified bits must be set to match the file. 

1st bit -used for special permission 

2nd bit- used for owner permission

3rd bit- used for group permission

4th bit – used for others permission

Find Files by Owner 

If a user wants to search for the files that are owned or controlled by a specific group or any user then we operate the -user and -group options.

In order to find all files and directories which are controlled by the user siyaram in this case, you would use:

#find / -user siyaram

Find Files by Owner


In this Tutorials, we learned the About the Find command in Linux I hope that now you are comfortable in Any open-source operating system. If your problem is still not solved share your Problem via comments. I Will try to solve your problem