iptables

* In the text below the single ‘-‘ in front of long option should be double ‘-‘, such as -dport should dash-dash-dport. WordPress messed up with double dashes.

. redirect all traffic destined to port 80 to port 22 only from a specific IP address
iptables -t nat -A PREROUTING -p tcp –dport 80 -s 127.1.1.2 -j REDIRECT –to-ports 22

. redirect all traffic destined to port 80 to port 22 only from a specific MAC address
iptables -t nat -A PREROUTING -p tcp –dport 80 -m mac –mac-source 00:06:5B:95:89:41 -j REDIRECT –to-ports 22

. list all rules in nat table
iptables -t nat -n -L

. delete rule 1 in nat table on PREROUTING chain
iptables -t nat -D PREROUTING 1

Install MySQL

Install MySQL
1) remove old package
$ rpm -e –nodeps mysql-3.23.58-9
2) install new packages of server and client
$ rpm -Uvh MySQL-server-4.1.3-1.i386.rpm
$ rpm -i MySQL-client-4.1.3-1.i386.rpm

Replace wth new line character in vi

In the replacement field, type ctrl+v+m (on screen, it looks like ^M); while in the search field, still use ‘\n’.

for example, replace all double new lines with a single new line

:s/\n\n/^M/g