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?
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?
I'm assuming ll
is an alias for ls -l
, in which case what's wrong with
du -hm /usr/local/apache2/logs/*
du -s /usr/local/apache2/logs/* | sort -rn | cut -f2 | xargs -d '\n' du -sh
Ok, not exactly what you asked for, but tree -fis
or tree -fih
might help you a bit and is a small, compact solution. :)
The first command outputs the recursive directory tree showing also the file size in bytes, the second one is the same but has "human readable" output, showing the size in kilobytes, megabytes, gigabytes... whatever it considers appropriate for that file.
Are you trying not to descend into subdirectories?
How about:
find . -type f -maxdepth 1 |xargs du -m
Pipe to "sort -n" if desired.