[ale] my 1st shell script - chk big files

Ron Frazier atllinuxenthinfo at c3energy.com
Sun Mar 20 11:04:55 EDT 2011


Hello all,

I've written my first Linux shell script as follows and saved it on the 
Desktop under the name Check Big Files and given it execute permission.  
I double click on it, the system asks whether to display or run it, and 
I say run.

echo "Files larger than 100 MB starting from /." > file_list.txt
echo "Excluding /swapfile, /sys/devices, and /proc." >> file_list.txt
echo -n "Computer name: " >> file_list.txt
uname -n >> file_list.txt
echo " " >> file_list.txt
date >> file_list.txt
echo " " >> file_list.txt
find / -type f -size +100M | grep -v /swapfile | grep -v /sys/devices | 
grep -v /proc >> file_list.txt
echo " " >> file_list.txt
date >> file_list.txt
gedit file_list.txt

It works very nicely, and give's me an instant report on large files in 
my system.  You guys can tell me if you think anything needs changing to 
improve it.  Anyone is welcome to use the script for their own 
purposes.  If you publish it somewhere, give me the credit.  Here's what 
it does.

1) Delete file_list.txt if it exists.
2) Create file_list.txt and put some headers, the computer name, and the 
date in it.
3) Find all files > 100 MB in size starting from / and list them in the 
text file, while excluding /swapfile, /sys/devices, and /proc.
4) Append the date to the end of the file.
5) Display the text file.

I have a question.  How would I force it to execute immediately, rather 
than asking if I want to display it or run it?

Sincerely,

Ron

-- 

(PS - If you email me and don't get a quick response, you might want to
call on the phone.  I get about 300 emails per day from alternate energy
mailing lists and such.  I don't always see new messages very quickly.)

Ron Frazier

770-205-9422 (O)   Leave a message.	
linuxdude AT c3energy.com



More information about the Ale mailing list