Unless you’re a perfectionist whose files are all diligently labeled and organized, chances are you’ve had to search for a file at least once in your life. If you’re a new Linux user, you might be wondering how to find files on Linux. The good news is there are several ways to do it, which means that everyone can choose the method that suits them best.
Generally speaking, there are two types of apps that help you find files and folders on Linux. The first are those that search the live filesystem every time. The second type are apps that build an index of files, then perform searches on the index. In this article you’ll find a balanced mix of both, and you can combine them depending on your needs.
How to Find Files in the Terminal
Yes, I know…you’re not a fan of the command-line interface. That’s cool – keep reading and you’ll discover apps that are more to your liking. However, don’t think you can escape the commands. Most of the apps on this list are just graphical interfaces for find and/or locate, so you’ll still be using them, only not directly.
Let’s start with the most important command. Find is one of the essential Linux utilities. It looks for a string in the directories you’ve set according to parameters (“switches”) that you’ve included. This example:
find /home/username/Documents -iname “writ*” -type f
means that you’re performing a case-insensitive (
-iname) search for files (
-type f) in the Documents folder, and their filenames begin with “writ”. As you can see, find supports wildcards, and you can also use them to find files by their extension (for example, “*.pdf” to find all PDF files in a folder).
You can search for empty files with the
-empty option, or find files by size and modification time. Find supports regular expressions, and if you want to search file contents, you can combine it with grep. To learn more, check the official documentation (or just type
man find in the terminal).
Locate uses a different approach. It relies on the updatedb utility which creates a database of your files and periodically updates it via cron scheduling. This lets locate know which files are currently present on your filesystem. You can also update the database manually whenever you want.
Locate can search for files by name, and you can use wildcards and regular expressions in your query. For instance:
locate -ei grub.cfg
will list the paths to all existing (-e) files called “grub.cfg”. The -i option stands for “case-insensitive”. If you don’t know the full name of the file you’re looking for, just type a part of it, and locate will display all files with the word in their name.
This command has a very specific purpose, so you probably won’t use it every day. Whereis shows you the location of the source, binaries, and user manuals for a given application. This means you won’t run whereis when you want to find a random text file. You will, however, use it when you need to check where GIMP or Firefox keep their configuration and executable files.
You can run whereis without any options to get a list of all files, or add switches for their respective functions (-b for binaries, -s for source, and -m for manuals).
How to Use a File Manager to Find Files
Most file managers for Linux can filter files by name or perform basic searches. If you don’t need any advanced parameters, this is a quick method that does the job.
Access the search function (highlighted in green on the screenshot) by pressing Ctrl+F or by clicking the magnifying glass icon in the toolbar. The search is case-insensitive, so you don’t have to worry about capitalizing your queries. You can filter files by type and location, although the latter is somewhat limited in terms of what you can adjust.
Dolphin’s search responds to the same keyboard shortcut (Ctrl+F), or you can open it from the Edit menu. It lets you filter files by name, content and location (current folder or the whole filesystem). If you have enabled file indexing with Baloo, Dolphin will be able to find files by type and modification date.
Krusader is popular among KDE users as a Dolphin alternative thanks to its abundance of advanced options. Krusader’s file search functionality is two-fold: it works as a GUI for both find and locate commands.
The former lets you tweak many details, such as file type, included or excluded directories, size, ownership, and file permissions. Krusader can search for keywords within files and even archives (like ZIP and TAR), and you can use regular expressions to customize your query. If you’ve never tried Krusader, now is the time to give it a chance.
Thunar integrates with the file search utility called Catfish to provide fast yet detailed results. You can filter files by type and modification date, and search file contents as well as their names. Catfish supports fuzzy (incomplete) filename matching, so you don’t have to know the exact name of the file you’re looking for.
How to Search for Files with Launchers
Launchers are usually used for, well, launching apps. However, you can also use them to find files by enabling various plugins. They’re quick and practical – you just start typing and the results pop right up. There are many launchers for Linux; we’ll focus on just a few examples.
Kupfer is a simple launcher available in the repositories of Debian, Ubuntu, Fedora, and Arch Linux. It comes with a bunch of plugins that let you find files with the locate command, and it can create its own catalog of indexed folders.
Kupfer is an action-based launcher. After typing in your search keyword, Kupfer will list actions that you can perform on/with the results. These depend on the plugins you’ve enabled, and you can activate them by selecting them in the drop-down menu.
KRunner is the default KDE launcher that you can configure in the System Settings – Plasma Search dialogue.
Like Kupfer, it supports numerous plugins that help you not only find files, but also interact with other Linux applications and parts of the Plasma desktop environment. KRunner can search YouTube and Wikipedia, show your recent documents, find files by type, and much more.
Albert is inspired by the Alfred launcher for OS X. Although it looks simple, Albert has plenty of options to play with. It also has – you guessed it – plugins, with “Files” being the most important here.
This plugin lets you create an index of directories that Albert will monitor and rely on. You can enable fuzzy (incomplete) matching and choose which types of files should be indexed. To find files, simply run Albert by pressing the designated keyboard shortcut and start typing your query.
Another Alfred-inspired launcher for Linux, Mutate doesn’t have as many options as Albert. Still, it features multiple search types, including file search. You can look for files by name and by file extension. The Preferences dialogue is somewhat unusual, because it shows which scripts Mutate is using, but doesn’t let you configure much apart from keywords and keyboard shortcuts.
Finding Files with Specialized Linux Apps
So far we’ve covered mostly simple file search solutions. They’re great for everyday lookups, but not so useful when it comes to complex queries and file contents search. If you need something more powerful, consider the following suggestions.
GNOME Search for Files
In case GNOME Search not installed on your distribution, look for the
gnome-search-tool package in the repository. GNOME Search is powered by locate, find, and grep commands, and supports wildcards as well as partial filename matching. You can combine multiple search options by choosing them from the drop-down menu and clicking “Add”.
KFind is the KDE equivalent of GNOME Search with a few extra options. It can search for filenames or file contents, and if you’ve enabled file indexing on your KDE system, it can search the index to speed up the process. The options are divided into tabs, and the last tab (“Properties”) lets you find files by size, modification date, and ownership. Apart from regular expressions and wildcards, KFind supports the question mark as a stand-in for a single character in your query. For example, searching for “no?es” will find files named “noses”, “notes”, “nodes”, and so on.
Ubuntu users faithful to the Unity desktop will be familiar with the Dash. Unity Dash is capable of finding your files and folders according to several parameters (filename, modification date, file type, size). To extend its functionality, you can install various Unity Scopes and Lenses. They integrate external services into Dash, enabling it to search for your browser bookmarks, Google Docs files, web history, and more.
SearchMonkey is a relatively old, but still completely functional desktop search app. Regular expressions are its main focus, and it has a “Test Regular Expression” tool that helps you build them. SearchMonkey supports all the essential search parameters (filenames, modification date, size, and file contents), plus the option to restrict the recursive search depth to a selected number of folders.
You can also save search results as a CSV file and limit the amount of results for every query.
DocFetcher is a desktop search engine for people who often need to search for file contents instead of just filenames. Think researchers, students, and other users who work with large collections of text-based files. DocFetcher first builds a database of files and folders that you choose. This database is automatically updated whenever DocFetcher detects that you’ve modified the files.
When searching for files, you can filter them by type and size, or use regular expressions for fine-grained queries. DocFetcher can search within PDF, EPUB, HTML, RTF, and Office files, as well as within archive files (ZIP, TAR, 7z…) and even Outlook emails.
One great thing about DocFetcher is that it has a portable version, so you can carry your database and the app on a USB stick and use it anywhere.
Recoll is probably the most powerful desktop search engine for Linux. It’s similar to DocFetcher: you use it to search through file contents. On first run, it will prompt you to create an index of files. You can select which directories and file types will be indexed, and limit files by size. Recoll will then set up an update schedule so that the index is always synchronized with the actual files. If you want, you can create multiple file indexes and search for files only in one, or in all of them.
You can look up files by name or search for keywords within files. Recoll lets you filter results by several criteria. It can also show related or similar files, search for phrases within files, and recognize word forms thanks to support for stemming. This means that you can search for “work”, and the results will include files that contain “working”, “worked”, “workers”…
Supported file formats include regular text files, logs, man pages, HTML, PDF, CHM, RTF, DJVU, and EPUB files, Libre and Microsoft Office files (including Excel and Powerpoint documents), TAR, RAR, 7z and ZIP archives. Note that external libraries or helper utilities might be required for some of them.
SEE ALSO: How to Sync Your OneDrive Account on a Linux Computer
Since most file search tools support the same options, choosing one is largely a matter of convenience, or deciding what works best for your typical workflow. This list might seem long, but there are more file search utilities for Linux. We’ll mention ANGRYsearch, a new project that strives to be the fastest search tool. And what about you? Do you know any other apps for finding files on Linux? What do you use – and can you share some tips? Let us know in the comments.
Image credits: Mutate screenshot, DocFetcher screenshot