5 Ways to Find a File in Linux Updated on February 19, 2025 by Jesse Owens 4 Minutes, 34 Seconds to Read Your Linux command-line interface (CLI) likely has many native options for how to find a file in Linux in all directories. You can have Linux find text in files and metadata. You can quickly list files that were changed within a specific time frame, useful for security information and event management (SIEM). There are also graphical applications for Linux systems with a desktop environment such as GNOME or Cinnamon. While there are many programs that can be used to find a file in Linux, not all are best suited for everyone’s common usage. They’re sorted based on how much you can do with the program. Terminal Commands to find Files and Directories Find Files in Linux with the ls Command and Glob Patterns The ls command is one of the most fundamental tools in any System Administrator’s toolbox. While not powerful or flexible as more advanced tools like find or locate, it’s often good enough and easier to remember when you need to find a file or directory in Linux. Glob patterns are similar to regular expressions, but also much simpler to remember and create. Glob patterns use the * (asterisk), ? (question mark), and [] (square brackets) to create search patterns with “wild cards.” * matches any string of any length (including no length) ? matches any single character ** matches zero or more directories Examples Find all files with a certain file extension, in any subdirectory of a certain location. In this example, we’ll list all of the PDF’s in the WordPress Media Library from the document root of the website ls ./wp-content/uploads/**/*.pdf Find a file with a date range in the filename. In this example, we’ll search a list of backup files from any day in February 2025 from a list of files using the format backup-DD_MM_YYYY.zip ls backup-??_02_2025.zip Find Files in Linux with find find is the most powerful tool on this list to find a file in Linux. Starting off, to view all regular and hidden files in a directory (and its sub-directories): find . “.” means to start from the current directory.“~” means to start from the current user home directory.“/” means to start from the system root directory. find /var/www/html/ find public_html/ The results will look similar to the ls command. You can add | less at the end to easily scroll through results. To narrow your search, you could use grep. However, the find command includes flexible options to provide the results you need. To view files and directories that start with “backup” (case-sensitive): find . -name "backup*" Use -iname instead for a case-insensitive search. To filter results to only regular files, add -type f: find . -type f -iname "backup*" To only list directories, add -type d: find . -type d -iname "backup*" You can filter results by size, under (-) or over (+) a specified number of kilobytes (k), megabytes (M), or gigabytes (G). Continuing with our examples above, to only show files over 1 megabyte starting with “backup”: find . -type f -size +1M -iname "backup*" You can combine search filters to narrow down results with -and, -or, and -not. To find files above 10 megabytes that are not zip or gz files: find . -type f -size +10M -not -iname "*zip" -and -not -iname "*gz" To search by permissions, use -perm followed by the permissions set: find . -perm 777 Execute commands with search results by adding -exec, the command to execute against the results, and {} \; at the end. The example below creates a sha512 checksum for all “backup” files found. find -iname "backup*" -exec sha512sum {} \; You can search for files accessed during, before (-), or after (+) a specified time frame. To list files accessed within the last 24 hours: find . -atime -1 Within 60 minutes: find . -amin 60 To view files in your home folder modified over 365 days ago: find . -mtime +365 Within 60 minutes: find . -mmin 60 To print output to the end of a text file, you can use >> file.txt or add the following to the end of your query: -fprint newfile Locate Files in Linux The locate command is much faster than find because it uses a pre-existing database updated by a cron job. To update the locate database manually: sudo updatedb Unlike the find command, locate searches the entire system by default. Therefore, searching for files and directories including “backup” in the name will return results from all directories. The results use the --wholename option by default. locate backup To search only the base name, instead of the entire file path, for a query: locate -b '\backup' You can use -i for a case insensitive search. In the example below, results would include files and directories starting with “backup” and “Backup.” locate -i "*\backup" mlocate takes over locate commands to find a file in Linux if both are installed. Unlike locate, mlocate only displays files accessible by the user. Find file paths to executables with commands like which and whereis. Graphical Applications to Find Files and Directories Catfish Catfish is a graphical search application to find a file in Linux desktop systems. It is often included in XFCE desktop environments (DEs). You can search directories by: File type Date modified File contents KFind KFind is a more advanced graphical search application native to KDE and the Konqueror file manager. The software allows you to filter searches by: File type Date modified File contents File metadata Date created File owner File size Learn more about managing headless Linux systems with our Cloud Server Hosting Product Guide. If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting. CentOS, Debian, or Ubuntu No Bloatware SSH and Root Access Share this Article Related Articles Understanding Linux Operating Systems How to Install Python 3.9 on CentOS 7 Speed Up grep Searches with LC_ALL=C How To Install RubyGems On Linux unrar and rar Commands 5 Ways to Find a File in Linux Setting Your PHP Settings in Command Line How to Check the Memory Usage on Linux How to Send Files to the Trash Can in Linux with Gio Trash How to Merge PDF Files in the Linux Terminal