Thursday, January 28, 2010

tar - extract files into a different folder

If you want to extract file into a different folder, using -C option

tar -C test -zxvf SWS-4.7.7.r945.tgz

All files extract to folder test

grep not match option

show the modified files in the past 24 hours, not including log file, or tmp file

find /var/www/ -mtime -1 | grep -v log | grep -v tmp

Tuesday, January 26, 2010

linux command sendmail with subject

If you send mail using sendmail command, there is no option for subject.
For example:
sendmail -F "system admin" -t "youself@gmail.com" < security.logHere is the trick how to using sendmail command to send mail with subject1, create your log file which you want to email to yourselfadd following line in the front of log file=====================#!/bin/shecho "From: system admin" > security.log
echo "To: youself@gmail.com" >> security.log
echo "Subject: security log" >> security.log

2, using this command to send mail

sendmail -oi -t < security.log



view log file dynamically - linux , tail

If you want to see real time changes, use -f option

sudo tail /var/log/auth.log -f