Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-20-2009, 01:51 AM   #1
Registered: Jan 2008
Posts: 258

Rep: Reputation: 30
Check the system

I would like to write a script to check do the system ,

if the directory size larger than xxx KB or no.of files is more that xxx , then send alert mail to me , can adivse what can i do ?

can advise what can i do ? thx
Old 08-20-2009, 02:04 AM   #2
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296Reputation: 1296

Find out which commands give you the result you want, try them out, put them all together in a logical order in a shell script and voila. Homework done!

Post what you have so far and/or what errors you are encountering and I'm sure someone will take it up.

Kind regards,

Old 08-20-2009, 02:57 AM   #3
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 70
I didn't quite get your description of the condition you want to check, but the find command has all the options you need to check the sizes of files and directories and process the information. du is another useful command in this regard.
Old 08-20-2009, 04:09 AM   #4
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
du is the command you want to start off with

'du -ah .' will list all the files and their sizes in the current directory. The list line will be the total size of the current directory. For the number of files, you can count all the other lines with 'wc -l'. Use 'head' and 'tail' to isolate parts of the beginning and end of the output from 'du'..


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
An error Occurred during the file system check. Dropping you to shell; the system wil aneikei Linux - Newbie 3 02-11-2010 08:38 PM
file system check 383gene Linux - Newbie 5 01-29-2009 06:08 PM
how can I check my system? Perquisitor Linux - Security 12 12-10-2007 01:04 PM
How to check system specifications? Niceman2005 Linux - Newbie 5 04-25-2005 05:21 AM
What to Check to make sure system is OK asmith1972 Linux - Newbie 7 05-20-2004 08:13 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration