LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2008, 10:33 AM   #1
zefyr
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Rep: Reputation: 0
listing directories larger than specified size?


Hello,

I would like to filter out all directories below a specific directory larger than 1GB. Like list all the Users home directories that are larger than 1GB. I'm experimenting with du -sk in combination with grep but I just can't seem to figure out how to do this. Im quite new to linux so bare with me.

Anyone has any thoughts on how to do this? Any help will be appreciated!

Regards,

Zefyr
 
Old 03-27-2008, 11:17 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You can use du in conjunction with gawk, e.g.
Code:
du -ks /home/*/ | gawk '$1 > 1000000 {print $2}'
 
Old 03-27-2008, 12:16 PM   #3
zefyr
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
You can use du in conjunction with gawk, e.g.
Code:
du -ks /home/*/ | gawk '$1 > 1000000 {print $2}'
Works like a charm, thank you!

While I'm at it, would you (or anyone for that matter) happen to know how to schedule this so that it runs every day at a specific time? That is if I put it in a script.

Thanks again!

Zefyr
 
Old 03-27-2008, 01:07 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You may have a look at
Code:
man crontab     # describes the crontab command
man 5 crontab   # decribes the syntax of a crontab file
In few words you can schedule a job by populating your own crontab. Use the command crontab -e to edit it and add lines like this:
Code:
35 17 * * 3 $HOME/test.sh
in this example the script $HOME/test.sh is executed at 5:35 PM every Wednesday. Good luck!
 
Old 03-27-2008, 02:09 PM   #5
zefyr
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
You may have a look at
Code:
man crontab     # describes the crontab command
man 5 crontab   # decribes the syntax of a crontab file
In few words you can schedule a job by populating your own crontab. Use the command crontab -e to edit it and add lines like this:
Code:
35 17 * * 3 $HOME/test.sh
in this example the script $HOME/test.sh is executed at 5:35 PM every Wednesday. Good luck!
I'll take a look at it, I'm sure I'll figure it out now!

Thanks for your help!
 
Old 03-27-2008, 07:27 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Here's a nice explanation/examples using cron
http://www.adminschoice.com/docs/cro...Crontab%20file
 
  


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
Listing Huge Directories Woodsman Slackware 8 12-16-2007 02:29 PM
Recursive directories listing cdog Linux - General 11 12-09-2006 07:04 AM
Listing all directories only anjanesh Linux - Newbie 5 06-20-2006 03:23 AM
Recompile glibc with larger stack size? insectile Slackware 3 07-20-2004 12:34 PM
file system size larger than fysical size:superblock or partition table corrupt klizon Linux - General 0 06-18-2004 04:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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