LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2014, 12:47 AM   #1
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Rep: Reputation: Disabled
list user space usage


I would like to list all users their disk space usage , and sort it by size ( the highest usage first ) , I have the below command but only check the current path usage , would advise what can I do ? thanks

du -ka . | sort -nr
 
Old 07-10-2014, 02:36 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
so replace the current path to home dir(s):
du -sk /home/*
 
Old 07-10-2014, 02:42 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Personally I might be inclined to use "human readable" on both the "du" and "sort". And maybe send stderr to the bit bucket ...
 
Old 07-10-2014, 03:20 AM   #4
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
so replace the current path to home dir(s):
du -sk /home/*
thanks reply ,

this method seems check the size of /home only , in my case , the user directory is under their own department as below , if use this method , it will show the size of department not individual user , would advise how to do it ? thanks

/home/ACC/user1
/home/ACC/user2
/home/EDP/user1
/home/EDP/user2
/home/HRM/user1
/home/HRM/user2
"
 
Old 07-10-2014, 03:25 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
probably du -sh /home/*/*
 
Old 07-10-2014, 04:36 AM   #6
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Original Poster
Rep: Reputation: Disabled
thanks reply ,

but it only show partial of user , not all users in my system .
 
Old 07-10-2014, 04:46 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
so you need to specify exactly what do you need. I have no any idea how should I look for those users and directories. Just use du, se man page about flags and use your preferred ones - and add the directories. You can use awk or perl or something to postprocess the result (if you need to do so)
 
Old 07-10-2014, 08:37 PM   #8
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Original Poster
Rep: Reputation: Disabled
Hi pan64 ,

what the requirement is just list the space used of all user , like below example , list the below 6 users , the size they used .

I tried to use du -sk to check each directory in /home , but only show the size of /home/ACC , /home/EDP , /home/HRM , not individual user .

would advise how to do it ? thanks


/home/ACC/user1
/home/ACC/user2
/home/EDP/user1
/home/EDP/user2
/home/HRM/user1
/home/HRM/user2
"
 
Old 07-10-2014, 09:00 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Did you read the manpage and try some of the other options ?. That is how you learn what they mean.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
list user space usage byran cheung Linux - Newbie 1 07-11-2014 12:59 PM
Netlink sockets usage to communicate b/w user and kernel space. vinodkr83 Linux - Newbie 1 07-03-2009 03:22 AM
vmsplice & splice usage in user space lennyk Programming 1 06-14-2009 08:56 AM
How to list file space usage estimate (du), SPECIFIED BY RANGE tsilok Linux - Newbie 6 10-24-2005 04:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:27 AM.

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