The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google unix.com



Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Disk Space test10002 HP-UX 1 07-07-2007 10:34 PM
disk space kingsto88 Filesystems, Disks and Memory 3 12-06-2006 05:28 AM
Disk space? jbarbuto SUN Solaris 4 08-18-2004 07:58 AM
available disk space on disk device??? alan UNIX for Dummies Questions & Answers 4 01-02-2004 03:06 AM
Disk space jxh461 Filesystems, Disks and Memory 1 06-24-2002 03:23 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2009
milkyway milkyway is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
disk space

Hello All-

Am new member to this forum. Have some unix experience. But true believer in it compared to windows.
Have a question regarding the disk space.

I know a command to check the total disk space utilization using:
df -k .

but what is the command to check the same disk space by user. How much each of the user is using the disk space.
  #2 (permalink)  
Old 05-22-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
There is no simple command to do what you need.

If people are using ridiculous amounts of disk space, instead of trying to police it yourself, enable disk quotas. If you tell us what you need someone here can help you put together a script.
  #3 (permalink)  
Old 05-22-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,507
this will not calc how much space is allocated to user, however it finds total size of files owned by user and totals them up.
Code:
awk 'BEGIN{
 path="/"
 user="root"
 total=0
 cmd="find "path" -type f -user "user" -printf \"%s\\n\""
 while (( cmd |getline line) >0){ total+=line }
 close(cmd)
 print "total size by user: "user" is: "total" bytes"
}'
  #4 (permalink)  
Old 05-22-2009
milkyway milkyway is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
disk space

No, I don't want the files sizes, am basically looking for the total disk space usage by a user.

If I give a username, I should be able to find how much he or she is using.

I have done this before, but don't remember the command now.
  #5 (permalink)  
Old 05-22-2009
laurentv laurentv is offline
Registered User
  
 

Join Date: Mar 2009
Location: Montreal, Canada
Posts: 33
Are you looking for the "du" command ?
  #6 (permalink)  
Old 05-29-2009
milkyway milkyway is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
That's right, am looking for du command that gives the disk usage by user.

-----Post Update-----

How do I run this?? Am only aware of unix commands.

Thanks

-----Post Update-----

How do I run this?? Am only aware of unix commands.

Thanks
  #7 (permalink)  
Old 05-29-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,837
If you run du on a directory, it will give you the size of that directory, not the disk space used by a user, eg. it won't count the files created by that user in /tmp, /var/tmp or other locations, and it will add files in the directory not owned by that user.

If you want the total size of files owned by a user, use ghostdogs command above.
Sponsored Links
Reply

Bookmarks

Tags
temp

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0