I'd like to be able to sort the output of "du -ah /" --exclude=/tmp >> files.txt" by filename, not by size. How can this be done on Linux? I'm comparing files on two different servers and then using a diff program to see the differences.


This will get a list of all files recursively, and output them to a file named "files.txt". The goal is to sort the files by filename for two systems and then compare every file using a diff tool (ie: TortoiseSVN Diff). Without sorting the list, it will be more difficult to see what files are different.

1 Answer 1


Try issuing du -ah / --exclude=/tmp | sort -k 2 >> files.txt


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.