Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does unix 'find' give the same order every time? [closed]

If I run find (Ubuntu, specifically), can I expect it to give me the same order of results every time? (Assuming, of course, that the actual files haven't changed.)

In other words, if I run

$ find foo

and it gives me

bar.txt
foo.txt

can I expect that it will never give me

foo.txt
bar.txt

?

like image 779
mfsiega Avatar asked Oct 20 '25 10:10

mfsiega


1 Answers

The answer is "probably" but you shouldn't rely on it because any number of things can affect it.

What order do you want the files in? Decide on that and then use a find command (perhaps piped into sort) which reproducibly gets the result you need.

like image 181
Perry Avatar answered Oct 22 '25 01:10

Perry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!