I am checking the file sizes of /tmp directory using du -h, but I also would like to have the ownership information of those files. There is a simple way to do this? I looked at the du manual and it seems to not have any option for this.

Thank's in advance.

  • 1
    du doesn't support sorting or analyzing disk usage by user. Look here: superuser.com/questions/597168/…
    – LawrenceC
    Mar 31, 2017 at 14:02
  • It can be done (but not simply) by filtering the output of each line, so as to add extra information about each file to the du output. If you're saving the results to a file, this is fine, but on the console the lines will not be generated in real time, because of pipe buffering (which you can disable at the cost of even more complexity). If this is of interest, I can put a script outline in an answer, but it's too complex for a comment.
    – AFH
    Mar 31, 2017 at 14:48
  • I was hoping someone had some killer script done in their bashrc or something like that. One way of doing this is to paste the output of recursive ls and du, assuming that the output of those two commands are sorted in the same way. Mar 31, 2017 at 14:58

1 Answer 1


You can use the following command and have a check .

stat -c "%y %s %n" /tmp/*

  • 2
    Can you add a couple of sentences to the answer to elaborate on the command parameters, what they do, and what this does to solve the question? The answer showed up in the review queue because the objective is answers that educate rather than just unexplained commands or code. Thanks.
    – fixer1234
    Apr 2, 2017 at 21:57
  • Since I want the user information I looked at stat manual (great linux command by the way), and the options I want are stat -c %y %s %U:%G %n. The only problem is that stat don't have any options do look inside each directory in /tmp, whereas du has --max-depth=N. Apr 4, 2017 at 12:16

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.