How to find files using command-line in the Linux Terminal

Learn how to use the 'find' command to search files and folders on your Linux system.

More often than not, files do get misplaced on your computer. For finding them, you will need to use some sort of tool and a bunch of rules. In today’s Terminal Tuts series, we’re going to explain how to find files on your Linux systems, by knowing any sort of information about the file and by using the terminal.

The utility provided by GNU in Linux for finding files is the find command. It’s much faster, efficient and precise than any manually installed program, or graphical program. In this article, we are going to assume that the readers are familiar with cd and ls commands.

find command

Let’s start with a few simple commands and parameters first where we will look for files on the basis of its name.


find -name abc

Since we are searching on the basis of name, notice the usage of the -name parameter. In the example, abc is the name of the file you are searching. The search will run in the working directory of your terminal session. Here are some important properties of the -name parameter:

  • The name has to be exact. It won’t search files with the given argument as a part of the name.
  • It is case sensitive.
  • It searches for both files and directories by the name that is provided.

Simple finding command.
Finding ‘test’.

Some modified usages of -name parameter:


Using -iname instead of -name makes the search case insensitive. It means that the search will not focus on whether the filenames are uppercase or lowercase.

Find -iname
Ignoring case of the name.

Searching using a keyword

To search for a file not by using its exact name but a keyword is simple too. All you have to do is modify the name of the file that you use for the -name attribute. The syntax is as follows:

find -name "*test*"

NOTE: The double quotes are not a mistake. If you don’t put in the quotes while searching for files with a keyword, you will get a syntax error.

Find keyword
Finding files using a keyword.

In the CLI, ‘*’ means everything. It displays any file names that have anything at all before the test, or after it. Additionally, you can use the -iname parameter instead of -name to make the search even broader.

File format

You can use the -name parameter to find files with a specific extension. For example, if you want to list all Python scripts, you can enter this code:

find -name "*.py"

Because all Python scripts use the .py extension.

Finding using a specific file format.


Next up, the -type parameter, which stands for the type of the file. The find command provides a number of options for the -type parameter but for most users, only two come in handy. They are the d and f values. The d value means that the user wants only directories listed, and f means that the user wants only the files (no directories) listed. Here’s an example:

Finding using a file type.

Other options available are:

  • c : Character (unbuffered) special
  • p : Named pipe
  • l : Symbolic link
  • s : Socket
  • d : Door (Solaris)


The find command can also find files based on their size. It uses various options for various size units. Some are:

  • c : For bytes.
  • k : For KBs
  • M : For MBs
  • G : For GBs

In the syntax, you have to put a number in front of the symbol that you’re using. For example, if you want to denote 50 MBs, then you have to write 50M.

You also have to put a ‘+’ or ‘-‘ before the number of units. If you want to search for files more than the quantity use ‘+’. If its less than the specified size, use ‘-‘.

Here’s an example where I’m searching for a file more than 400MB. I have named the file 465 because that’s its size.

Finding using a size detail.

Range of size

Since you can mention a more than and less than the limit, you can also combine the two to search for files in a certain size range. This requires two -size attributes. For example, if I have to search for files more than 400MB but less than 500MB in size, I can use this:

find -size +400M -size -500M

Here’s an example:

Finding using a size range.

Setting a location

To search for files in a directory, navigating to the directory is not necessary. You can also specify the location of a directory if that’s the only place where you want to search the files. The location has to be written right after the find. So if you want to mention the location, you have to do so before any parameters or values.

For example here, I search in the Downloads directory:

find Downloads/ -name test


Finding in a specific directory.

Similarly, if you want to search for a file in the whole system, just use / as the location. You will need root access or superuser permissions, hence use sudo before the command. Remember that it will take a bit of time as it is scanning the entire system. Example command:

sudo find / -name abc


That’s all about the significant and most useful options of the find command on Linux systems. All these options may seem a bit difficult to remember at first, but as you start using it on a regular basis, and you’ll be using the Terminal method rather than the GUI method most often! We hope this article helped.

Any queries are welcome in the comment section. Cheers!

Pulkit Chandak
Pulkit Chandak is a Linux enthusiast and has been using and experimenting with open source software and hardware too since a long time. He is a huge admirer of open source software and wants to ventilate it to all around him. He is interested in reviewing and writing tutorials on Linux and its many distributions. He believes that freedom in software leads to freedom of the mind from the chains of limits.


Please enter your comment!
Please enter your name here




How to setup FTP Server on CentOS

You are allowed to use any one of the FTP servers as you like. However, in this tutorial, we will be installing and using vsftpd, short for Very Secure FTP Daemon. It is a fast, stable, and secure FTP server that will help you transfer files to and from a remote system in a jiffy.

CentOS Vs. Ubuntu Server : Everything You Need to Know

Choosing the perfect Linux distribution to set up your server can be confusing since Linux provides a limitless number of options. The main reason behind these many distributions is because Linux is an opensource platform. Anybody with the required skills can contribute to the development or build and release their distribution. Currently, there are more than 600 Linux Desktop and Server distributions in the market.

Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.

The 10 Best Linux Network Monitoring Tools

Having total control over your network is essential to prevent programs from overusing your network resources and slowing down the overall performance. This is why you should install a network monitoring tool on your system, giving you a visual overview of everything that's happening on your network. Networking Tools are like swiss-knife for the system administrators for troubleshooting system issues.

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

5 Best Music Players for Linux

For sure, there will be Linux users out there who cannot live without music. If you're one of those people, you would know how important it is to have a good music player installed on your computer system. In this article, we present to you the five Best Music Players for Linux, which will hopefully be able to satisfy each of our readers' needs.

Linux Mint vs. Ubuntu – which is best for you?

The conundrum is that which one among them? The best solution is to try both of them out, and then choose whatever seems to work the best for your needs. But here, we're giving you some distinctions between the both that might make it easier for you to make a choice.

6 Essential Command-Line Utilities Every Linux User Should Know

Last week, we shared with you several "cool and fun" commands to get comfortable and confident with the Linux command-line. In our quest to further aid Linux users with mastery of the command line, or CLI, we present you with a variety of command-line utilities essential for all Linux users, regardless of proficiency level.

How to create a Live Linux USB drive using Etcher

In the Linux community, one thing is common between almost all of the users: trying out different Linux distributions. Most of the Linux based distributions have a great way of being tested as they provide ISO images for creating a Live USB.