I've tried to list the size of subdirectories of the directory home just taking the files with pdf extension.

I tried the next

ls $home -d /* | xargs du -sb --exclude="!(*.pdf)"

Is there any --include option for du? or what should be the right pattern in the exclude option?

find ~ -type f -iname "*.pdf" -exec du -sh {} \;

-exec runs programs being you mentioned via {} , Indeed you say to find command such as:

du -sh   *.pdf  

-type specifiy type of file , f mentioned to regular file.

And ~ mentioned to path base path of search.

-iname mentioned to Incasentisive search.

| improve this answer | |
  • You have been around long enough to know that posting a solitary command is not often considered the most helpful thing to do. Consider expanding your post with some explanation or links to helpful resources that support your solution. – HalosGhost Oct 6 '14 at 19:54

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.