Score:5

How to search a certain folder or disk and only get the results for that folder or disk

cn flag

I searched a disk for a certain file name and I got the results for the whole pc. I made sure the file manager window was inside the disk (CANON_DC) like this and searched ike.enter image description here

The file manager window was in CANON_DC. As you can see by some of the directory names, like Documents/Jeshua.. and Pictues/fun photos... All these are from the home folder. I got files for the whole pc; not just the disk. How can I narrow this down?

JoshuaD avatar
in flag
Catfish is a really nice GUI solution, and it pretty easy to integrate with the various linux graphical file managers.
vanadium avatar
cn flag
Could that be because you are using tracker? Normal behaviour for Nautilus also would be to search starting from the current directory
sudodus avatar
jp flag
Is it OK with a command line solution, or must it be a GUI solution?
Will avatar
id flag
@sudodus - would be nice to have both!
Score:6
jp flag

The command line way

You can use find to find a file in a specified directory tree, for example

$ find ~ -name "*bashrc*"
/home/sudodus/.bashrc

$ find /etc -name "*bashrc*"
/etc/bash.bashrc
/etc/skel/.bashrc

find is a very powerful tool. It takes time to learn everything, but this is a good start. See man find, read tutorials via the internet and ask here at AskUbuntu in order to learn more about it.

The GUI way

It seems the built-in search tool in Files alias nautilus will search the whole computer. But there are many Linux tools, that can be installed in Ubuntu. You find them easily via the internet, e.g. via this link

Some of them let you specify the search path or 'filter', for example FSearch, ULauncher, Catfish.

Recoll is an advanced tool that can also search for content in the files (corresponding to grep on the command line).

Arun avatar
ru flag
You can take the command-line solution to the next level by feeding the search results from `find` to file manager [`nnn`](https://github.com/jarun/nnn) so you can navigate through the results and analyze them visually - `find ~ -name "*bashrc*" -print0 | nnn -H`
sudodus avatar
jp flag
@Arun, yes, it is possible and some users will find it useful. You are welcome to write an answer where you show how to do it, for example with a demo with some screenshots.
Arun avatar
ru flag
I have shared the command which is an extension of your example. That should be enough to try it out.
sudodus avatar
jp flag
@Arun, OK. Anyway, I did look at your github page and the animation :-)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.