Wednesday, March 19, 2008

Remove all empty directories

$ cleanlinks

this is supported on few flavor of Linux (XFree86), you can use this script.

#/bin/bash
DIR="$1"
[ -d $DIR ] && [ $(ls -l $DIR | wc -l) -eq 1 ] && rmdir $DIR || :


$ script.sh dir1

Removing blank line from file

Using sed.
$ sed '/^$/d' withblankline.txt > withoutblankline.txt
Using grep.
$ grep -v '^$' withblankline.txt > withoutblankline.txt

Use following for loop (shell script) to remove all blank lines from all files stored in /home/prabhat/data directory:

#!/bin/sh
files="/home/prabhat/data/*.txt"
for f in $files
do
sed '/^$/d' $i > $i.out
mv $i.out $i
done

How to check reverse DNS

The DNS is used to determine what IP address is associated with a given host name, so to reverse resolve a known IP address is to lookup what the associated host name for it. A reverse lookup is often referred to simply as reverse resolving, or more specifically reverse DNS lookups.

Use of reverse DNS.
Anti-spam
Network troubleshooting
Avoid spammers and phishers using a forward confirmed reverse DNS etc

Check reverse DNS for given IP address under Linux or Windows XP/Server 2003.
You can use standard UNIX / Linux utilities such as nslookup, dig or hosts to find out reverse DNS of a given IP address.

eg; under Linux/UNIX/
$ host 66.65.123.34
or
dig -x IP (66.65.123.34)
and under Linux/UNIX/Windows
nslookup 66.65.123.34

SHOW ENGINE INNODB STATUS

  The SHOW ENGINE INNODB STATUS command in MySQL provides detailed information about the internal state of the InnoDB storage engine. This ...