Archive for December, 2011


Recently one of my PuTTY sessions froze, and I decided to try and kill it using the command line, instead of simply closing the window.
This is the complete procedure:

  1. I opened another PuTTY session
  2. using the who command I found the name of the frozen TTY
    myuser@ubuntu:~$ w
    14:21:07 up 119 days, 12 min, 2 users, load average: 0.06, 0.05, 0.05
    USER  TTY   FROM        LOGIN@ IDLE  JCPU  PCPU  WHAT
    user1 pts/0 192.168.x.x 13:02  1:36  1.81s 0.10s sshd: user1 [priv]
    user1 pts/2 192.168.x.x 14:21  0.00s 0.46s 0.00s w
    myuser@ubuntu:~$
  3. using ps and grep i found its PID
    ps -u root | grep -i pts/0
  4. finally, I killed the blocked session:
    kill -9
Advertisements

To backup a single mysql database, use the following command:

:~$ mysqldump -u my_user_name -p db_name > backup_of_my_db.sql

If compression is needed, the command changes like this:

:~$ mysqldump -u my_user_name -p db_name  | gzip -9 > backup_of_my_db.sql.gz

To extract the compressed .gz file, use the following gunzip command:

:~$ gunzip backup_of_my_db.sql.gz