mira_mayhem
mira_mayhem

Reputation: 155

unix "find" command native sorting order

If I use the find-command (no options except -name) - which is the order the output will be sorted in?

My own investigation showed it's neither alphabetically nor datetime-ly.

Searched the man pages, but I couldn't locate anything related to this.

Thanks in advance!

Upvotes: 4

Views: 3536

Answers (2)

Yaniv
Yaniv

Reputation: 164

Hope this post will help. If not, you can always grab the find command algoritm because linux is open source, to see what exactly he does. note you will need some c knowledge. type in your distro and i'll find you the code

Upvotes: 1

sat
sat

Reputation: 14979

find command traversing the files and directories as they appeared in file system.

Test:

find . -maxdepth 1 -name '*' 
ls -Ul

Here,

-U - do not sort; list entries in directory order

Upvotes: 4

Related Questions