21

I am re-asking this question: How to remove a specific folder from the Ubuntu search? because I do not believe it was a duplicate, or was answered in that post.

This has nothing to do with Zeitgeist OR recent files. (I already have zeitgeist and file history monitoring disabled.)

I would like to know if it is possible to prevent Unity Search from displaying the contents of a specific directory in its search results - ie: not to include that directory when searching. The same way you can tell it not to include online search results.

Thanks /H

3 Answers 3

38

Actually I think this is a built-in feature. It's a common thing to need to exclude directories from your search. Here's how to configure it:

Open the system settings
Select "Security & Privacy" Go to the tab named "Files & Applications"

You should see a box named "Exclude", use the "+" and "-" buttons to update this. Anything NOT excluded will be used in the search.

Note that you will also need to "Clear Usage Data" from the "Files & Applications" dialog in order to remove previously browsed files and folders from the Dash Search. By default Dash Search will include your historical file usage even if you have explicitly excluded these files.

6
  • 1
    I had to test this to be sure, as the interface in question appears to pertain only to File History records and exclusion. However, I searched for some particular files, added their containing folder as an exclusion, and can verify that they did in fact no londer appear in the search.
    – Hearth
    Jan 24, 2014 at 1:37
  • 1
    I'm using 16.04 and there doesn't appear to be such a setting anymore. Oct 5, 2016 at 14:00
  • same here on 14.04
    – tigerjack
    Jan 5, 2017 at 16:58
  • This capability still exists in 16.04.
    – Astrid
    Aug 21, 2018 at 15:02
  • One limitation of this method, at least on 16.04, seems to be that if you exclude a directory, the contents of that directory are excluded, but the directory itself can still show up in search and in the recently used "Files & Folders" section of the dash. Nov 3, 2018 at 14:33
2

You can make a directory/file hidden. I. believe that unity does not search into hidden files and folders.

To hide a file, add a dot. before it. I.e to hide a folder named documents, right click it, click on rename, and rename it as .documents

1
  • 1
    I can verify that this does work - hidden folders are not searched from the unity UI. However, this may not always be an ideal solution.
    – Hearth
    Jan 24, 2014 at 1:35
0

this is not much easy I think. I will tell you what I know that you can hide all files from the unity search by removing its files lenses with the command as

sudo apt-get remove unity-lens-files

That will hide all the files from unity search.

  • one more thing that can help you is create a new user and put the directory which you would like to hide in his home directory. so Unity can not search in his area.

    (or)

  • change the folder/file attributes to root user only , so that unity can not list you that item in search.

hope that helps,:)

1
  • Thanks, I will check it out. I assumed that unity search ran as a service or system process (similar to windows indexing service) but if this works, I may be able to make a workaround using the folder permission attributes.
    – Hearth
    Aug 26, 2013 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.