Tuesday, September 22, 2009

Reset a Frozen SSH Session

I mentioned previously that you can reset a shell by typing "reset."

There is another problem that can cause a shell or xterm to freeze. If you ssh to a remote host, and then logout, sometimes the session will freeze. In that case, all you need to do is type "Enter", "~", "." (Enter, Tilde, Dot with no spaces) to get the console back. That's the Enter key, immediately followed by tilde "~", and then a period "."

[Enter]~.

Also, a convenient way to exit a shell, xterm, or remote ssh terminal is to use Ctrl-D rather than taking the time to type the word "exit."

Wednesday, September 9, 2009

Script to Unlock Firefox

I wrote a script to unlock Firefox on a linux machine. The symptom is when firefox is not running, but it won't let you start because it thinks it's still running. If you have already run "pkill -9 –f firefox", then all you have to do is delete the lock files -- .parentlock, and lock.

This is user specific, so you'll have to find your own home directory under ~/.mozilla/firefox/. Mine is dz4bq7je.scottm on this host.

$ cat ~/bin/unlock_firefox.sh
#!/bin/sh
rm ~/.mozilla/firefox/dz4bq7je.scottm/.parentlock
rm ~/.mozilla/firefox/dz4bq7je.scottm/lock
$ ll ~/.mozilla/firefox/
total 12
drwx------ 9 scottm users 4096 Sep 9 11:25 dz4bq7je.scottm
-rw------- 1 scottm users 1264 Jun 23 2008 pluginreg.dat
-rw-r--r-- 1 scottm users 162 Nov 15 2005 profiles.ini
$

The advantage of this simple script is that you don't have to go looking for directories and files, or remember where firefox puts them. Just remember when it's locked, look for your unlock script.