From: rvaede on 26 May 2010 11:33 If I do an ls -al 2006* in a directory how can I find the size of these files? I am having trouble combining the two using the du command
From: Anonymous on 26 May 2010 12:47 If they are plain files, du -sk 2006*, or ls -ls 2006*. If they are directories, do they contain . files?
From: hume.spamfilter on 26 May 2010 13:54 rvaede <rvaedex23(a)gmail.com> wrote: > If I do an ls -al 2006* in a directory how can I find the size of > these files? > I am having trouble combining the two using the du command du sums *each* on the command line, not stdin or the sum of all the files given. You don't need ls for this (and the -a and -l actually hurt you). Use something like: du -k 2006* | awk '{ sum += $1; } END { print sum }' And that will print the number of kilobytes used just by the 2006* files and directories in the current directory. -- Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
From: rvaede on 26 May 2010 13:56 On May 26, 12:47 pm, Anonymous <cri...(a)ecn.org> wrote: > If they are plain files, du -sk 2006*, or ls -ls 2006*. > > If they are directories, do they contain . files? Yes there are subdirectories thats the issue.
From: starwars on 27 May 2010 07:49 On May 26, 12:47 pm, Anonymous <cri...(a)ecn.org> wrote: > rvaede > > If they are plain files, du -sk 2006*, or ls -ls 2006*. > > If they are directories, do they contain . files? > > Yes there are subdirectories thats the issue I am unsure exactly what you are trying to do. You said: > If I do an ls -al 2006* in a directory how can I find the size > of these files? and: > there are subdirectories thats the issue. If you are trying to find the sizes of each directory in directoryies 2006*, then this will do it: find 2006*/* -prune -type d | xargs du -sk That will give you the size of directories under 2006* and all their sub-directories. Another possibility might be: echo 2006*/* | xargs du -sk for files and directories. If that's not what you are trying to do, what are you trying to do?
|
Next
|
Last
Pages: 1 2 Prev: "sdtvolcheck" and "cat /tmp/.removable" processes Next: Available RAM on SunOS 5.10 |