find . -printf "%u  %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}'

Hi I have been using the above CMDline to look for each user's disk usage information. I would like to know whether is there a method to send the users an email if they exceed 200gb on the disks with an automated script? Thanks

Note: There are 10 users in the disks

  • Do you have quotas enabled? – ErikF Jan 17 '18 at 2:34
  • Hi, nope unfortunately I dont and i am not able to. – Kuan Jan 17 '18 at 2:54
  • On my system (4 users, 2 wihh little/nothing in ~/, one with a few gigs, and one with 250+gb) sudo du -sh * runs MUCH quicker than the find/awk combo does for me. parse that for a string that matches 19[0-9]GB and then cut off the user part, use that as input to a mail call (even though you don't have quotas enabled you can check the quotad cron that sends reminders) – ivanivan Jan 17 '18 at 5:04
  • Hi, due to restriction purposes, I am not able to run as an administrator, So that's why i ran the find/awk cmdline – Kuan Jan 17 '18 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.