Using "find" to search an entire system

Status
Not open for further replies.

anneranch

Active Member
Joined
Mar 16, 2019
Messages
223
Reaction score
43
Credits
2,078
qw@qw-desktop:~$ sudo find . -name "mdi.pro"
./Downloads/qt-everywhere-src-6.2.1/qtbase/examples/widgets/mainwindows/mdi/mdi.pro
./Qt/Examples/Qt-6.2.2/widgets/mainwindows/mdi/mdi.pro
qw@qw-desktop:~$

REALLY STUPID question:
The above searches ONLY current folder .
I need to search entire multi OS for LAST mdi.pro file used.

Help would be appreciated .

I'll be happy camper if I search RUNNING OS only.
 


qw@qw-desktop:~$ sudo find . -name "mdi.pro"
You can replace the the .(dot) with the path you want to search, for example / or /home and you only need to use sudo to search locations that your user doesn't have access to.
Code:
sudo find / -name "mdi.pro"
find /home/qw . -name "mdi.pro"
.(dot) means current folder
..(dot dot) means parent folder
~(tilde) means your homedir
 
You can replace the the .(dot) with the path you want to search, for example / or /home and you only need to use sudo to search locations that your user doesn't have access to.
Code:
sudo find / -name "mdi.pro"
find /home/qw . -name "mdi.pro"
.(dot) means current folder
..(dot dot) means parent folder
~(tilde) means your homedir
Also, if you're searching the entire file-system, you might get a lot of error messages in your output.
For example, when find starts searching in places like /proc/ - which contains running processes. It may throw errors about being unable to stat, or open the files in there. This can be a problem even if you're running find as root.
So if searching from the root of the file-system, it's often worth redirecting any error messages to /dev/null, so you don't see them!
e.g.
Bash:
sudo find / -type f -name "mdi.pro" 2> /dev/null

There are ways to tell find to exclude certain directories - but I'm pretty lazy. Rather than keeping track of which directories find might have trouble accessing and then specifying to exclude those directories from the search - I simply leave it to iterate through them all from the file-systems root /. And redirect all error messages to the bit-bucket as per the previous example.

That way, I don't have to type a bunch of extra code to exclude a handful of directories, or sit through an endless stream of error messages! Ha ha!
Just a little tip!
 
I use Catfish to search for all things on the drop down on left side select File System - select the Gear on the right to included Hidden Files if you want the just type in what your looking for
catfish.png
 
catfish new one to me ; just installed it on Arch , i will see how it compares to find


used find recently to check for duplicate images ; the way i did it was using a to take one image eg IMG_20160420_093807.jpg at one location and test to see if it existed at other i.e Toshiba for it at another. I knew that if there was a duplicate for that one image , then all the others would be as well . I used :

Code:
find  /run/media/andrew/"TOSHIBA EXT"   -name   IMG_20160420_093807.jpg   -print

it worked fine ,but did i need to use -print ?
 
catfish user here too.

simple & quick.
 
catfish new one to me ; just installed it on Arch , i will see how it compares to find


used find recently to check for duplicate images ; the way i did it was using a to take one image eg IMG_20160420_093807.jpg at one location and test to see if it existed at other i.e Toshiba for it at another. I knew that if there was a duplicate for that one image , then all the others would be as well . I used :

Code:
find  /run/media/andrew/"TOSHIBA EXT"   -name   IMG_20160420_093807.jpg   -print

it worked fine ,but did i need to use -print ?
No, you didn't need to use -print, because -print is the default action!
 
Thanks , with little hiccups - no progress indicator - it seems to work as advertised.

Addendum
Pretty impressive tool , even if it is "only" "find" wrapped in GUI.
Found little snag - search for "BT_*" finds
"ebt_xxxx".

But I did not RTFM, maybe I missed some option.
Same goes for "folders" - assuming it means transversing down
the tree, so far no go.

I feel it would be a good idea to "see the progreess" to make sure the search is going
correct direction.

And the "usual problem" - it takes forever to scan 3TB drive....
 
Last edited:
Status
Not open for further replies.

Staff online

Members online


Top