How to find a File in Linux

If you are new to Linux, you will find this resource helpful. We go through various ways (command-line & GUI) of finding files on a Linux system.

In general, users prefer using the graphical file browser to search for a specific file. However, there exist few powerful commands that can help you find your file in your Linux system. In this tutorial, we are going to show you how to search for a missing file using various ways.

Find Files in Linux

The following methods will be covered in this guide:

  • Searching your machine using the command line
  • Search your machine using a graphical user interface

Before starting our guide, let’s first create a new file that we will try to search for in this tutorial. To make a new file, use the touch command as follows:

touch findme

Create New File
Create a New File

Search using the Command-Line

During this method, we are going to use the command line via the Linux terminal. Basically, there are two different commands to search for a file:

  • find command
  • locate command

Search using “find” command

The “find” command allows you to find files in your system. You can search by a part or full file name. Also, it can be used to search for files modified at a particular time.

For example, to search for files in the current directory that starts with the “fi” letters use the following command:

find . -name fi*

File in Current Directory

The dot or “.” here means to search in the current directory. Also, in case you need to search in a specific location, you can specify it as follows:

find /home/tuts/ -name fi*

Search For a Certain File in a Given Location
File in a Given Location

Additionally, if you do not know the file name, but you only know the file extension, then you can effortlessly search with the file extension as follows:

find /home/tuts/ -name *.png

Search For With File Extension in a Given Location
File Extension in a Given Location

Moreover, if you need to retrieve all the empty files in the current location, use the following command:

find . -type f -empty

Search For Empty Files in a Given Location
Search For Empty Files in a Given Location

Now in case, you need to search for particular files that were modified at a specific time then use the below command:

find /home/tuts/ -name *.png -mtime 2

Search For a File By Modification Date in a Given Location
Search For a File By Modification Date in a Given Location

As you can notice, the “-mtime” tag can be used to specify the files that were changed in the past two days.

Search using the “locate” Command

Using the locate command will help you search for a file. Basically, the locate command is easy to use as following:

locate findme

Search For a File Using Locate Command
Search For a File Using Locate Command

Search Using the Graphical User Interface

This is the simplest and preferred method that can be used to search for a file on your computer. First, you need to open a file browser. In most of the Linux distros, it’s called “Files” with a folder icon.

Open File Browser
Open File Browser (Ubuntu)

Then click on the search button.

Press the Search Button
Press the Search Button

Next, in the search bar, write down what you need to search for.

Search For a Certain File
Search For a Certain File

Furthermore, you can click on the drop-down arrow to search with more advanced options, including date, content, etc.

Search By Date
Search By Date

Congratulations, you have just learned how to search for a file in your Linux machine. That’s it for now, and I hope you have enjoyed it.

Hend Adel
Hi! I'm Hend Adel, a freelancer technical geek with successful experience in Database, Linux and many other IT fields. I help to build solutions to suit business needs and creating streamlined processes. I love Linux and I'm here to share my skills via FOSS Linux! Thanks for reading my article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,281FansLike
386FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

MUST READ

Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
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.

6 Best CPU Stress Test and Performance Benchmark Linux Tools

Do you want to push your Linux system to its maximum limits? Or are you interested in evaluating your Linux PC in terms of performance? Either way, benchmark apps and stress test tools can give you a quantitative understanding of the performance of your Linux PC.

5 Best Ways to Free up Hard Disk Space in Ubuntu

Hard disk space can easily get filled up with cached package files, old kernels, and other obsolete files that occupy unwanted hard disk space. Here are top five best and safer ways to clean and free up hard disk space in Ubuntu. We show you Terminal and GUI way of cleaning up system.

7 Best Ways to Kill Unresponsive Programs in Linux

For dealing with a frozen app or desktop, you can't use the CTRL+ALT+DEL in Linux system. Instead, there are powerful alternatives that come in handy in frustrating situations. We pick the best methods available for you.

VIDEO: Linux Lite 4.8 Features and Desktop Tour

Linux Lite eases Windows 7 users transition to Linux much more comfortable by offering simple software like Team Viewer, VLC, Firefox, TimeShift backup utility, and a full Microsoft Office compatible office suite in LibreOffice.