[ale] my 1st shell script - chk big files
Richard Bronosky
Richard at Bronosky.com
Sun Mar 20 23:53:49 EDT 2011
For this kind of thing, you really ought to be using github. Even if you
never host a full open source project, for something like this you post a
"gist". For example, here is one of mine:
https://gist.github.com/806251That will open you up to an entire
community of people who can "fork" your
scripts and post their changes. I often use it for oneliners that I want to
keep handy, like my evil: https://gist.github.com/422582 But I also use it
to host things as simple as a single line of code that I often want to
reuse, like: https://gist.github.com/570492
Do that enough and you will eventually have so many code patterns in your
toolkit that you can make an open source repo out of them, like:
https://github.com/RichardBronosky/tools/tree/master/bash.patterns
The point is this: If you write code, any code, you should be on github.
On Sun, Mar 20, 2011 at 11:04 AM, Ron Frazier <atllinuxenthinfo at c3energy.com
> wrote:
> 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
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
--
.!# RichardBronosky #!.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110320/e7d4bee5/attachment.html
More information about the Ale
mailing list