Saturday, April 11, 2015

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?


Answer



I'm assuming ll is an alias for ls -l, in which case what's wrong with



du -hm /usr/local/apache2/logs/*

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...