0

I see many methods of searching (or finding) files in current directories or even a specific tree, but am unable to locate an option for me.

I have an Ubuntu 18.04 LTS setup with 14 drives mounted individually (UUID mounted in the FSTAB, just in case that matters). They are all SATA (which doesn't matter I'm sure), but they are mounted separately, so no RAIDS, no JBODS, no other way of linking; why i look at my Files, i see the 14 mounted drives plus the system SSD.

I need to be able to search all these drives with a single CLI for a file with a specific file type. In this example, let's assume I'm searching for any and all files that are .iso files; how can i do this fairly easily, hopefully with the find command, but at least with minimal coding rather than a full Perl script or something. I'm not a total coding noob, but this one has been bothering me.

TIA

4
  • 1
    Have you looked at the locate file database? Run updatedb and then locate *.iso and it will show you everything that was available at the time updatedb was run. Jul 26, 2019 at 6:44
  • would i have to run this on each drive, or does it search them all in one go? Jul 26, 2019 at 7:18
  • It searches everything that's mounted at the time, so long as you have permission to access it. I generally run sudo updatedb to get everything. Jul 26, 2019 at 7:19
  • i find that it only searches the drive i'm currently looking at (i planted some in random places to see if they got caught, however, the find command located them all without a problem, so i'll just use that; it didn't take very long, so it's no problem for me in the long run Jul 26, 2019 at 7:25

2 Answers 2

1
find / -name "*.iso"

which will find (starting in /) all files that end in .iso

You may want to add 2>/dev/null if there are many directories you don't have read access to & don't want many permission denied errors amongst the output.

1
locate *.iso

locate will be many times faster than find command.

If the .iso was just created today you will need to update the database first:

sudo updatedb

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.