TranslateProject/sources/tech/20211216 Hide or Add Specific Folders From GNOME Search Results in Ubuntu and Other Linux Distributions.md
DarkSun 28e63c824c 选题[tech]: 20211216 Hide or Add Specific Folders From GNOME Search Results in Ubuntu and Other Linux Distributions
sources/tech/20211216 Hide or Add Specific Folders From GNOME Search Results in Ubuntu and Other Linux Distributions.md
2021-12-16 05:04:34 +08:00

7.6 KiB
Raw Blame History

Hide or Add Specific Folders From GNOME Search Results in Ubuntu and Other Linux Distributions

You might have already noticed that when you search for something in the GNOME menu/activities area, it also shows the files with names matching the searched term along with installed applications.

Search in GNOME activities shows installed applications and matching files

Thats a handy feature. If you remember the file name or even part of it, you can easily search for it and open it just by pressing the Super key (Windows key) and typing the name.

But there are a few nit bits around this search feature that you might not know about or never cared for.

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

Note: This is exclusively for distributions using GNOME. Please verify which desktop environment you are using and ensure it is GNOME.

The GNOME search feature utilizes a utility called Tracker Miner FS. Please do not get alarmed by the terms like tracker and miner. Its not spying on you or mining crypto on your system. It basically functions as a search engine and a database to provide you instant search results.

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

Default locations for file search

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

However, the recently accessed files are also indexed automatically. If you have opened a file recently, it is added to the recent files and will appear in the search results irrespective of its location.

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

Accessing recent files in GNOME file manager

Adding a folder content to search results

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

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

Open the Settings application by searching for it in the menu/activity area:

Search for settings application

Go to the Search option from the left sidebar and click on the Search Locations option at the top. In the pop-up window, go to the Other tab and click on the + symbol. It will add the file browser and you can add your desired folder.

Adding a custom folder content to search

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

Hide a folder from search results

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

If you dont want the content of the meta folders like Pictures, Documents, Videos in search, you disable it from the Search Location settings.

Disable meta folders from the search

If you want the contents of only a certain folder under Documents to NOT appear in the search result, you just have to create a new file named .nomedia in that folder. You may also name the file .git, .trackerignore or .hg.

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

If you dont see the option to create new file in right mouse lick, youll have to do some tweaking to add the create new document option in the right click context menu. Also note that any files starting with a . in its name is hidden from normal view. To toggle hidden files, press Ctrl+H keys.

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

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

You can delete the recent files history or disable it altogether (if you want) from Settings-> Privacy-> File History & Trash. I dont see the need of it, though, so make your own decision here.

Clear or disable file access history in GNOME

Disable search results for all files

If you do not want any files to appear in the search results, you can disable search for Files altogether from the search settings.

Disable search results for all files

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

More details on it can be found on the projects homepage.

Conclusion

The discussion here is about file search. GNOME desktop also searches in Calendar, Characters and some other utilities. You can disable or enable the available search options but lets not focus on that.

I hope you find this quick tip helpful in customizing your GNOME experience. If you know some other neat trick that you want others to know, please share it with us in the comments.


via: https://itsfoss.com/control-gnome-file-search/

作者:Abhishek Prakash 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出