In windows XP, after switching to advanced search mode I used to be able to search for multiple files merely by adding a comma between them like this....


and that would return the 3 image files that I was looking for.

How can I do this in Linux ??

  • 2
    which GUI you're referring to ? – pLumo Sep 25 '18 at 12:47

I don't think you can use the gui for that. You could use the command line for that:

find /path/to/dir -regex ".*\(90025\|90028\|90094\).*"

This will search for file names containing these numbers.

| improve this answer | |
  • FWIW kfind does it, using ; as the separator instead of , but you have to use wildcards. So the search would be *90025*;*90028*;*90094* if you were looking within the filenames. Something like recoll or docfetcher would certainly do it too. – pbhj Sep 25 '18 at 13:29

On the command line in gnome-terminal (konsole, yakuake, or whatever) then locate takes multiple arguments and searches for a match on any one of them.

locate 90025 90028 90094

Will return all files that match any of the strings.

man locate will give more information, for example how to match AND-wise, how to use regular expressions to search, etc.. locate relies on a database of files which is updated using sudo updatedb.

A BASH script one-liner like:

dirt=$(mktemp -d -p ~); cd $dirt; for i in $(locate 90025 90028 90094); do ln -s $i; done

Will make a temporary directory beneath your home directory that links to all of the files found in the locate command. You can sort through that directory and delete the soft links you don't want (this doesn't delete/affect the files they link to). I use a similar process to gather photos to share online.

| improve this answer | |
  • Just reviewing this and it's notable that it doesn't work for filenames with spaces in, passing locate through xargs should work: something like dirt=$(mktemp -d -p ~); cd $dirt; for i in $(mlocate -i 90025 90028 9009 | xargs -0 echo ); do if [ -f "$i" ]; then ln -s "$i" $(mktemp -u XXXX)_$(basename "$i"); fi done works for me to handle files with spaces and filename clashes and avoid passing directories to ln (ie stop errors). – pbhj Aug 2 at 23:27

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.