Order of unix find files in two directories with or command

What is the expected file order if the following find is run on Linux:

 mkdir /tmp/dir1 /tmp/dir2 touch /tmp/dir1/1 /tmp/dir1/2 /tmp/dir2/1 /tmp/dir2/2 /tmp/dir2/3 /tmp/dir2/0 find /tmp/dir1 /tmp/dir2 -name 1 -or -name 0 -not -name 2 /tmp/dir1/1 /tmp/dir2/1 /tmp/dir2/0 

Is it always supposed to always return results from dir1, then dir2, or can the results be mixed in order?

+7
linux unix bash
source share
1 answer

The find command will search for directories in that order. Since you said

 find /tmp/dir1 /tmp/dir2 ..... 

he will always look for evrything first, which matches below / tmp / dir 1, then / tmp / dir2.

However, subdirectories and files can, of course, appear in any order.

+11
source share

All Articles