Enable Num Lock on Gnome startup

Run the following command:

Explanation: install numlockx, generate a backup file for /etc/gdm/Init/Default, edit it

su -c 'yum install numlockx'  su -c 'cp /etc/gdm/Init/Default /etc/gdm/Init/Default_backup'  su -c 'gedit /etc/gdm/Init/Default'

When the text editor is launched, go to the bottom part of the file, add the following before exit 0

if [ -x /usr/bin/numlockx ]; then
    /usr/bin/numlockx on

Save and restart Gnome or reboot system to see if it works!


  1. http://www.unixmen.com/linux-tutorials/documentations-a-howto/118-how-to-enable-num-lock-on-gnome-startup-
  2. http://www.cyberciti.biz/faq/how-to-linux-turn-on-num-lock-on-gnome-startup/

Useful Linux commands #2

ps -efww|grep sqlr-listener|grep -v grep|cut -c 9-15|xargs kill -9
实 时查看正在执行的sql语句
/usr/sbin/tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | egrep -i 'SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL'
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"t",state[key]}'
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more


netstat -tna | cut -b 49- |grep TIME_WAIT | sort |morenetstat -an | grep TIME_WAIT | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more


netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | morenetstat -an | grep ":80" | grep ESTABLISHED | sort | more


ps -efww|grep sqlr-listener|grep -v grep|cut -c 9-15|xargs kill -9


netstat -anpo|grep php-cgi|wc -l

Useful Linux commands

Find files older than 60 days
find * -mtime +60

Delete files in backup folder which are older than 60 days
rm -f `find /backup/ -mtime +60`

Search for a string inside files
grep -H -r “search me” /var/www

Find files owned by apache user
find /var/www/ -user apache

Find directories owned by apache user
find /var/www/ -user apache –type d

Listing files in a directory
ls -lh

Copy an entire directory (files + subdirectories)
cp -R existingdir/ newdir/

Zip up an entire directory
zip -r zipefilename foldername

Count total number of files in a directory
ls -1 | wc -l
find . -type f | wc -l

Get directory size
du -hs /var/www

Get amount of free disk space available
df -h

Get Linux version details
uname -a
cat /proc/version

Source: http://eisabainyo.net/weblog/useful-linux-commands/

HTML Tidy on linux under XAMPP

Installing tidy on PHP5 under linux is pain. The manual says  “compile with –with-tidy”, but it is not really happening.

Finally I made it work on my fedora (using XAMPP) by this method:

# Install libtidy

yum -y install tidy

# Download PHP 5 source


# Unpack the source

tar xvzf php-5.3.0.tar.gz

# Configure tidy for installed php5 API

cd php-5.3.0/ext/tidy


# Stay at the same folder, Configure & Compile the source

./configure --with-php-config=/opt/lampp/bin/php-config --with-tidy

make clean    <-- Without this the compile builds a bad module for some reason


make install

# Install module into php.ini - Add:: extension="tidy.so"

vi /opt/lampp/etc/php.ini


ubuntuforums.org: LAMP: php5-tidy doesn’t exist!

newsn.net 给AndLinux下面的xampp装tidy模块的经验 (Chinese)