LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-04-2012, 10:17 AM   #1
joeblow12
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
Home directory size limit script


I am trying to create a script that will allow me to run the following:

du -sh /home/*

but remove all the lines that have over 32MB of information. I am unable to use disk quotas or i would have tried that. please help?
 
Old 01-04-2012, 10:40 AM   #2
joeblow12
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I'm trying to write a script to check the home directory and provide me with the directories over 32MB.

du -sh /home/*

10MB /home/user1
32MB /home/user2
6MB /home/user3
40MB /home/user4
8MB /home/user5
21MB /home/user6
35MB /home/user7

I want to only be shown or in a file

32MB /home/user2
40MB /home/user4
35MB /home/user7
 
Old 01-04-2012, 11:25 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
du -s /home/* 2>/dev/null|while read SIZE ITEM; do [ $SIZE -gt 30000 ] && du -mhs "${ITEM}"; done
 
Old 01-04-2012, 11:43 AM   #4
yongitz
Member
 
Registered: Nov 2005
Location: Davao City, Philippines
Distribution: RHEL, CentOS, Ubuntu, Mint
Posts: 139

Rep: Reputation: 20
I hope this is not an assignment, but something like this would work:

Code:
du -s /home/* |du -hs `awk '{ if ($1 > 1024*32) print $2}'`
 
  


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
[SOLVED] home directory size monitoring script allancuntapay Programming 6 11-07-2009 06:59 AM
Limit Users Home Directory Size KrGAce Linux - Newbie 6 10-24-2005 09:48 AM
/home/directory size limit Smokey Slackware 2 11-04-2004 03:11 PM
How to LIMIT my HOME DIRECTORY SIZE??? juliann Linux - Networking 2 07-21-2004 09:08 AM
Mandrake /home directory size Limit problem psyientist Mandriva 9 05-14-2004 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:24 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