LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-20-2004, 10:21 PM   #1
vince_2x
LQ Newbie
 
Registered: Sep 2004
Location: Australia
Posts: 7

Rep: Reputation: 0
help understanding this command


Hi there!
does any one have an idea of how I would sum up the total disk space use by a user's files in a particular directory.

for example, say I wanna find out the total disk space use by user samy in the /var/ directory..

thanks
 
Old 09-20-2004, 11:22 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Hmmm ... good question. Maybe something like:

find . -user <username> -type f -ls | awk 'BEGIN {total=0} {total += $7} END {print total}'

would work. Of course, if /var is its own partition, and you have the quota utilities installed, you can just use repquota. If you're going to try to limit the amount of disk users can use, that's probably the way to go.
 
Old 09-20-2004, 11:48 PM   #3
aiza
LQ Newbie
 
Registered: Jul 2004
Posts: 18

Rep: Reputation: 0
Re: help understanding this command

Quote:
Originally posted by vince_2x
Hi there!
does any one have an idea of how I would sum up the total disk space use by a user's files in a particular directory.

for example, say I wanna find out the total disk space use by user samy in the /var/ directory..

thanks
du -sh /directory
 
Old 09-21-2004, 12:01 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Re: Re: help understanding this command

Quote:
Originally posted by aiza
du -sh /directory
Where does samy come into the picture?


Cheers,
Tink
 
Old 09-21-2004, 12:42 AM   #5
vince_2x
LQ Newbie
 
Registered: Sep 2004
Location: Australia
Posts: 7

Original Poster
Rep: Reputation: 0
Talking vince_2x

Oh thanks a lot btmiller.. this is exactly what I wanna do .. somehow I did modify the command a bit to get precise results.. somethink like


find /var/ -user $USER -type f -exec du -s -k -h {} \; | awk 'BEGIN {total=0}{total += $1}END{print total}
^^^^^^^^^^^^^^

thanks a lot
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
understanding read command as a test frankie_DJ Programming 11 08-08-2005 01:30 PM
help understanding ln dr_zayus69 Linux - General 3 01-14-2005 08:33 PM
A better understanding! nny0000 Slackware 1 04-14-2004 12:01 PM
Understanding df -k itsjustme Linux - General 6 10-28-2003 12:08 PM
burning cdrs using cdrecord (ver2.0) from the command line (understanding) hamster Linux - General 2 05-13-2003 06:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration