LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 11: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, 12:17 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can use du in conjunction with gawk, e.g.
Code:
du -ks /home/*/ | gawk '$1 > 1000000 {print $2}'
 
Old 03-27-2008, 01: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, 02:07 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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, 03: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, 08:27 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,252

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 02:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration