Sponsored Content
Top Forums Shell Programming and Scripting Users and their storage usage Post 302696941 by HakerDemon on Wednesday 5th of September 2012 10:25:38 PM
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
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
QUOTA(1)						    BSD General Commands Manual 						  QUOTA(1)

NAME
quota -- display disk usage and limits SYNOPSIS
quota [-ghu] [-v | -q] quota [-hu] [-v | -q] user quota [-gh] [-v | -q] group quota -d [-gh] [-v | -q] DESCRIPTION
quota displays users' disk usage and limits. By default only the user quotas are printed. Options: -d Query the kernel for default user or group quota instead of a specific user or group. -g Print group quotas for the group of which the user is a member. The optional -u flag is equivalent to the default. -h Numbers are displayed in a human readable format. -q Print a more terse message, containing only information on file systems where usage is over quota. -v quota will display quotas on file systems where no storage is allocated. Specifying both -g and -u displays both the user quotas and the group quotas (for the user). Only the super-user may use the -u flag and the optional user argument to view the limits of other users. Non-super-users can use the -g flag and optional group argument to view only the limits of groups of which they are members. Only the super-user may use the -d flag. The -q flag takes precedence over the -v flag. quota tries to report the quotas of all mounted file systems. If the file system is mounted via NFS it will attempt to contact the rpc.rquotad(8) daemon on the NFS server. If quota exits with a non-zero status, one or more file systems are over quota. SEE ALSO
libquota(3), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8), rpc.rquotad(8) HISTORY
The quota command appeared in 4.2BSD. BSD
May 12, 2012 BSD
All times are GMT -4. The time now is 02:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy