Users and their storage usage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Users and their storage usage
# 1  
Old 09-05-2012
Users and their storage usage

Hey, I'm trying to make a script that can list users and their storage usage in a file. Im trying to get it to where the format is:

User xxkbs
User2 xkb

and so on. So far I figured out how to get the users, but I cannot figure out how to get the storage usage per user.

This is what I have so far:
Code:
#!/bin/sh
# This script displays a user friendly message that lists the top 10 users of
# storage on the system in human readable form.

awk -F ":" '{ print $1}' /etc/passwd > usersAndStorage

#add storage usage part here and append to file using tabs

while read line
do 
	user=$(echo "$line" | cut -f1)
	#add usage here so it will show in terminal
	echo $user
	echo
done <$1

Thanks a lot to anyone who can help.

Last edited by Franklin52; 09-06-2012 at 04:19 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 09-05-2012
Something to keep in mind: It's possible to have files owned by userid's which have no entry in /etc/passwd.

Regards,
Alister
# 3  
Old 09-05-2012
I know that, but the script is only supposed to report the storage of users in passwd, I'm not worried about other users. Thanks for the input though
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storage usage over time

Hi every one, im kind new in scripting. i need to write a script that will collect my storage usage (df -k) like every hour and save the max amout and min amout into csv file so over time lest say one month we have the min/max values. Is it possible with awk command ? Any ideas are welcome.:) (4 Replies)
Discussion started by: venus699
4 Replies

2. Emergency UNIX and Linux Support

Usage by users

I would like to know how to capture the usage of CPU by each user. Is there a way to do this on AIX? Gaya (0 Replies)
Discussion started by: ggayathri
0 Replies

3. Shell Programming and Scripting

Space usage by top 5 users in a filesystem

I want to see top 5 users,who have occupied most amount of disk space in a filesystem. But not sure how to do it. I can get the usage for a particular user find . -user user -type f exec df -h {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }' But how to get without specifying any user... (6 Replies)
Discussion started by: rka
6 Replies

4. UNIX for Dummies Questions & Answers

CPU usage restrictions for users?

I was wondering if there was a way to set resource usage per user. For example, if I use "grep -f <file1> <file2>" and the two files are very big it consumes a lot of resources. Onetime someone pinged me and asked what the hell I was doing and to kill it. Is there any way an SA can restrict... (7 Replies)
Discussion started by: MaindotC
7 Replies

5. AIX

balance CPU usage between users

Hi! Is there any way to balance CPU usage between users on percentage basis? Something like Resource Manager in Oracle databases. Regards. ---------- Post updated at 02:17 PM ---------- Previous update was at 02:09 PM ---------- Workload Manager? ---------- Post updated at 03:44 PM... (0 Replies)
Discussion started by: bas_ua
0 Replies

6. UNIX for Advanced & Expert Users

any quicker way to list disc usage by users?

Hi: it takes a long time for "du -sh list_of_users" to give you the output. Is there a quicker way to get this info? Thanks! N.B. Phil (4 Replies)
Discussion started by: phil518
4 Replies

7. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

8. AIX

AIX 4.3 storage usage report

hi, i'm new to this company and i'm using old AIX 4.3 with DAS and SSA storage. What is the best way to query a report for disk capacity, usage, free, etc. I know in AIX 5 there's a command for "du -g /" or "du -m /" to report the total usage but I'm not using AIX5. In AIX 4.3 I can use "df... (5 Replies)
Discussion started by: venerayan
5 Replies
Login or Register to Ask a Question