To compare files recursively, between 2 directories on Linux
To kill all processes of a certain type:
ps -ef | grep <string> | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null
To check status of previous command:
check_last_command()
{
if [ $? -eq 0 ] ;
then
#good
else
#bad
exit 1
fi
}
To check if a file exists:
#
if [ -f /path/filename ]; then
.
.
<do something>
.
.
fi
To check if a port is busy
netstat -an | grep <string>
To lookup dns
nslookup < >
To send email
mailx -s "<message>" abc@cde.com < "mail_message_file_name"
dir1=/home/...../dir1
dir2=/home/...../dir2
diff --brief --recursive --new-file --no-ignore-file-name-case $dir1 $dir2
To kill all processes of a certain type:
ps -ef | grep <string> | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null
To check status of previous command:
check_last_command()
{
if [ $? -eq 0 ] ;
then
#good
else
#bad
exit 1
fi
}
To check if a file exists:
#
if [ -f /path/filename ]; then
.
.
<do something>
.
.
fi
To check if a port is busy
netstat -an | grep <string>
To lookup dns
nslookup < >
To send email
mailx -s "<message>" abc@cde.com < "mail_message_file_name"