HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How can I get the disk usuage of a perticular user
Operating System - Linux
1830340
Members
2329
Online
110001
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 04:40 AM
05-22-2009 04:40 AM
Hi,
I have a user request to provide the disk usuage of the user's home dir with the names
I issued this command and got only the disk usuage and ID's from the /home dir
#du -sk * | sort -rn
7468504 remoquil
5803904 pzhysl
3069352 7en0fm
2033224 wabtec
1966224 paez
1888472 mentordata
1810456 infodba
1650224 tek
1536368 reydl2
1443248 redquest
1380168 nzr3k0
1283928 tanney
1124520 gz1tbp
852048 export
759984 yell31
723312 kzd0d7
702120 xztmhq
641744 mesparza
616408 bz1r42
462456 radochon
433568 zz6cw0
433248 rongkobu
395800 bedenfie
But i need the users names to be printed from /etc/passwd files too with it
Eg :
Disk usuage ID Names
7468504 remoquil selva kumar
5803904 pzhysl rajesh baskar
3069352 7en0fm harish khan
2033224 wabtec senthil kumar
1966224 paez santhosh kumar
1888472 mentordata priya
1810456 infodba jeyram
Can someone provide me a simple script to print the diskusuage with id's and get the similarnames from the passwd file
EG:
# awk -F ";" '(print $1 "\t" $5)'
will this get only the names fom the /etc/passwd file ????
I need a script for it
Thanks
Harish
I have a user request to provide the disk usuage of the user's home dir with the names
I issued this command and got only the disk usuage and ID's from the /home dir
#du -sk * | sort -rn
7468504 remoquil
5803904 pzhysl
3069352 7en0fm
2033224 wabtec
1966224 paez
1888472 mentordata
1810456 infodba
1650224 tek
1536368 reydl2
1443248 redquest
1380168 nzr3k0
1283928 tanney
1124520 gz1tbp
852048 export
759984 yell31
723312 kzd0d7
702120 xztmhq
641744 mesparza
616408 bz1r42
462456 radochon
433568 zz6cw0
433248 rongkobu
395800 bedenfie
But i need the users names to be printed from /etc/passwd files too with it
Eg :
Disk usuage ID Names
7468504 remoquil selva kumar
5803904 pzhysl rajesh baskar
3069352 7en0fm harish khan
2033224 wabtec senthil kumar
1966224 paez santhosh kumar
1888472 mentordata priya
1810456 infodba jeyram
Can someone provide me a simple script to print the diskusuage with id's and get the similarnames from the passwd file
EG:
# awk -F ";" '(print $1 "\t" $5)'
will this get only the names fom the /etc/passwd file ????
I need a script for it
Thanks
Harish
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 04:53 AM
05-22-2009 04:53 AM
Re: How can I get the disk usuage of a perticular user
I would like to get printed only the names one by one in the next line from the /etc/passwd file. the comments are in 5th column
# awk -F ":" '(print $1 "\t" $5)'/etc/passwd
Please suggest here
# awk -F ":" '(print $1 "\t" $5)'/etc/passwd
Please suggest here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 05:42 AM
05-22-2009 05:42 AM
Re: How can I get the disk usuage of a perticular user
How can i execute both the commands in the single script :
# cd /home
#du -sk * | sort -rn
#awk 'BEGIN {FS=":"}
>{print $5,}' /etc/passwd
The output which i get from du -sk * must be the input for the /etc/password file. i need only the details of the users who have the disk usuage high
All these needs to be written in a single script
Please help
# cd /home
#du -sk * | sort -rn
#awk 'BEGIN {FS=":"}
>{print $5,}' /etc/passwd
The output which i get from du -sk * must be the input for the /etc/password file. i need only the details of the users who have the disk usuage high
All these needs to be written in a single script
Please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 07:06 PM
05-22-2009 07:06 PM
Solution
>How can I execute both the commands in the single script? I need only the details of the users who have the disk usage high
How high?
If you don't have zillions of users, you can build up an associative array.
cd /home
du -sk * | sort -rn | awk '
BEGIN {
limit = 100 * 1024 # 100 Mb
# create name array
FS=":"
while (getline < "/etc/passwd" == 1){
name[$1] = $5
}
close("/etc/passwd")
FS=" "
}
$1 > limit {
print $0, name[$2]
}'
How high?
If you don't have zillions of users, you can build up an associative array.
cd /home
du -sk * | sort -rn | awk '
BEGIN {
limit = 100 * 1024 # 100 Mb
# create name array
FS=":"
while (getline < "/etc/passwd" == 1){
name[$1] = $5
}
close("/etc/passwd")
FS=" "
}
$1 > limit {
print $0, name[$2]
}'
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP