Hide or add specific folders from GNOME search results

You may have already noticed that when you search for something in GNOME’s menu/activities area, it also shows files whose names match the search term as well as installed applications.

Searching GNOME Activities shows installed applications and corresponding files

It’s a handy feature. If you remember the name of the file or even part of it, you can easily find and open it by simply pressing the Super key (Windows key) and typing the name.

But there are a few bits around this search feature that you may not know about or may never have cared about.

In this article, I will share how you can control the GNOME search feature, add or hide folders from the search option, and disable it altogether.

Note: This is exclusively for distributions using GNOME. Please check which desktop environment you are using and make sure it is GNOME.

Default locations for searching files

The GNOME search function uses a utility called Tracker Miner FS. Please don’t be alarmed by terms like tracker and minor. It’s not about spying on you or mining crypto on your system. It basically works as a search engine and database to provide you with instant search results.

By default, file indexing takes place in meta-folders such as the Documents, Music, Pictures, and Videos directories and their subdirectories. Files in the Home and Downloads folders are also indexed, but those in their subdirectories are not.

gnome default search location
Default locations for searching files

If you have created new directories in your home folder, these files will not be indexed.

However, recently accessed files are also indexed automatically. If you’ve opened a file recently, it’s added to “recent files” and will appear in search results regardless of its location.

In case you don’t already know, you can see your recently accessed files in the file manager:

access recent files gnome linux
Access recent files in GNOME File Manager

Adding Folder Content to Search Results

Suppose you have created a folder for coding projects in your home directory. These files will not be indexed and will not appear in search results (unless you have opened a file by double-clicking and it is added to recent files).

To add files from a custom folder to the search result, you can add the folder to search locations.

Open the Settings app by finding it in the menu/activity area:

Finding Ubuntu 20 04 Settings
Find the settings app

Go to the To look for option in the left sidebar and click on the Research locations option at the top. In the pop-up window, navigate to Other tab and click the + symbol. It will add the file browser and you can add the desired folder.

gnome add search location
Adding custom folder content to search

If you test by searching for a filename in the folder you just added, you should now see it in the search results. It should be instantaneous, but if not, try logging out or restarting the system.

Hide a folder from search results

If you don’t want files from a specific folder to appear in the search result, you can hide it.

If you don’t want the contents of meta folders such as Pictures, Documents, Videos to be searched, you disable it in the search location settings.

disable folders from search
Disable meta folders from search

If you want the contents of a certain folder under Documents NOT to show up in the search result, just create a new file named .No media in this file. You can also name the file .git, .trackerignore, or .hg.

hide a specific folder from search results
Hide a specific folder from search results by creating a file named .nomedia or .hg or .git

If you don’t see the option to create a new file on right-click, you’ll need to make some adjustments to add the Create New Document option to the right-click context menu. Also note that all files starting with a . in its name is hidden from normal view. To toggle hidden files, press Ctrl+H.

This hiding may not work immediately because the file is probably already indexed. You may need to log out or restart to see the effect.

If you access a file manually, it will be added to recent files and appear in the search result despite the skipped file in the folder.

You can delete recent files history or turn it off completely (if you want) from Settings->Privacy->File History and Recycle Bin. I don’t see the need for it, so make your own decision here.

clear or disable gnome linux file history
Clear or Disable File Access History in GNOME

Disable search results for all files

If you don’t want any files to appear in the search results, you can completely disable file search from the search settings.

disable gnome file search
Disable search results for all files

You should completely disable the search functionality by clicking the search toggle button at the top as it may interfere with the normal functionality of the GNOME desktop environment.

More details about this can be found on the project homepage.

Conclusion

the the discussion here is about finding files. The GNOME desktop also searches the calendar, characters, and some other utilities. You can disable or enable available search options, but let’s not focus on that.

I hope you find this quick tip useful for customizing your GNOME experience. If you know of another cool trick that you want others to know about, share it with us in the comments.

Comments are closed.