[opensuse] A question on find and how to out to file
Hey guys, I hope this one get answer quickly. I have a drive that almost 80% full. I am not sure what has filled it. So I am writing a bash script to do a quick audit of my drive. #!/bin/bash # This is an audit log # this is looking for logs, txt, compress and tar balls to see what is # filling up / on all the dam boxes textfile=audit_files_`date +%m%d%Y`.txt sizefile=files_size_`date +%m%d%Y`.txt find / -name *tar >> /tmp/$textfile find / -name *gz >> /tmp/$textfile find / -name *tgz >> /tmp/$textfile find / -name *txt >> /tmp/$textfile find / -name *logs >> /tmp/$textfile for i in `cat $textfile` ; do ls -ltsha $i >> /tmp/$sizefile ; done The problem I am having is nothing is getting wrote to my text file. Everything I this I get a 0 size file. What am I doing wrong? -- ---------------------------------------- When a place gets crowded enough to require ID's, social collapse is not far away. It is time to go elsewhere. The best thing about space travel is that it made it possible to go elsewhere. -- Robert Heinlein -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Chuck Payne schrieb:
The problem I am having is nothing is getting wrote to my text file. Everything I this I get a 0 size file. What am I doing wrong?
Don't know what is causing this, but changing the first line to #!/bin/bash -v may give you some hints. Anyway, simply using du -aS / | sort -n > ~/filesizes is _much_ faster and also more secure. Regards nordi -- Spam protection: All mail to me that does not contain the string "suse" goes to /dev/null. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Thanks Nordi. Yes much better.
Sent from a blackberry
On 1/14/09, nordi
Chuck Payne schrieb:
The problem I am having is nothing is getting wrote to my text file. Everything I this I get a 0 size file. What am I doing wrong?
Don't know what is causing this, but changing the first line to
#!/bin/bash -v
may give you some hints. Anyway, simply using
du -aS / | sort -n > ~/filesizes
is _much_ faster and also more secure.
Regards nordi
-- Spam protection: All mail to me that does not contain the string "suse" goes to /dev/null.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- Sent from my mobile device ---------------------------------------- When a place gets crowded enough to require ID's, social collapse is not far away. It is time to go elsewhere. The best thing about space travel is that it made it possible to go elsewhere. -- Robert Heinlein -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Chuck Payne
-
nordi