This is a discussion on Shell command to find dir sizes under /usr within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi Gurus, Newbie here. I am using AIX 5.1 I am trying to find the directory sizes of all ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi Gurus, Newbie here. I am using AIX 5.1 I am trying to find the directory sizes of all subdirectories under /usr (or any directory). I would like a list of immidiate sub directories of /usr with their sizes. I do not want recursive output. Here is what i tried unsuccessfully cd /usr ls -1 | du -sk $1 //gives error on $1 ls -1 | du -sk {} \; //borrowed the syntax from find command, got errors. tried find command but could not figure out how to stop find from descending deeper than the first level. I was gonna try find . -type d -exec du -sk {} \;//works except it is recursive Thanks |
| |||
| PG wrote: > Hi Gurus, > > Newbie here. > > I am using AIX 5.1 > > I am trying to find the directory sizes of all subdirectories under > /usr (or any directory). I would like a list of immidiate sub > directories of /usr with their sizes. I do not want recursive output. > Here is what i tried unsuccessfully > > cd /usr > ls -1 | du -sk $1 //gives error on $1 > ls -1 | du -sk {} \; //borrowed the syntax from find command, got > errors. > > tried find command but could not figure out how to stop find from > descending deeper than the first level. I was gonna try > > find . -type d -exec du -sk {} \;//works except it is recursive > > Thanks cd /usr for dir in `ls -l |awk '/^d/ {print $9}'` ; do du -sk $dir ; done -- Jason |
| ||||
| PG wrote: > Hi Gurus, > > Newbie here. > > I am using AIX 5.1 > > I am trying to find the directory sizes of all subdirectories under > /usr (or any directory). I would like a list of immidiate sub > directories of /usr with their sizes. I do not want recursive output. > Here is what i tried unsuccessfully > > cd /usr > ls -1 | du -sk $1 //gives error on $1 > ls -1 | du -sk {} \; //borrowed the syntax from find command, got > errors. > > tried find command but could not figure out how to stop find from > descending deeper than the first level. I was gonna try > > find . -type d -exec du -sk {} \;//works except it is recursive > > Thanks This works for me on AIX 5.2: # cd /usr; du -sk */ Mind you, this does miss out on what /usr itself contains. But you did say you wanted the subdirectories :-) HTH Andy (Not a guru!) |