06-15-06 06:28 AM
balreddy.gattu@gmail.com wrote in
<1150310986.555812.100360@y41g2000cwy.googlegroups.com> on Wed, June 14
2006 14:49:
>
> Hello,
> Iam trying to find the size of each user used in a common directory.
> Do we have any direct command to get the results?
>
> example: i want to find the total size of each users files under
> /tmp.
>
There are various ways to do this. Under a system that supports filesystem
quotas, merely enabling quotas would allow you to then view the usage by
user/group on the drive. Alternatively, you could use a shell script to
collect the information and partially automate the process for you. For
that, you could probably:
* have the script do an 'ls -lR' on the target directory, cut the user name
out of the list, sort and then uniq it.
* then, loop through that list of users, and have it add the sizes of each
file owned by that user together, presenting each user as it computes it.
How the script does these things is going to vary based on some of the tiny
nuances of your UNIX-like system (e.g., # of spaces in output of 'ls',
whether the filesize is listed in bytes, blocks, or whatever, etc.)
HTH,
Mike
--
Registered Linux User #417338, machine #325045.
...and that is how we know the Earth to be banana-shaped.
[ Post a follow-up to this message ]
|