How to do "du" on all files under a directory in linux?
This is what I tried:
[demo@ ~]# ll /usr/local/apache2/logs/|xargs |du -hm -
du: cannot access `-': No such file or directory
I want to see the amount of space each file occupies in m
unit.
How to do it the correct way?
Solution 1:
I'm assuming ll
is an alias for ls -l
, in which case what's wrong with
du -hm /usr/local/apache2/logs/*
Solution 2:
du -s /usr/local/apache2/logs/* | sort -rn | cut -f2 | xargs -d '\n' du -sh