HJW
HJW

Reputation: 23443

What is Unix find command's default ordering?

I was searching through the man pages for find for clues of UNIX find command default ordering.

Appreciate if anyone knows this.

http://unixhelp.ed.ac.uk/CGI/man-cgi?find

Upvotes: 2

Views: 1213

Answers (2)

Jon Lin
Jon Lin

Reputation: 143906

The find command uses the opendir() function to get listings in a directory, which returns a directory stream, and it traverses the stream and evaluates each entry. The ones that matches criteria are returned in the order they are evaluated. Therefore, the order you get from the find command is how the underlying filesystem presents them.

Upvotes: 2

jlliagre
jlliagre

Reputation: 30833

find just peeks the files and subdirectories as they appear in the directories, just like ls -U when this option is available.

Upvotes: 4

Related Questions