http://bit.ly/termdetect
homepage:Termdetect is a script that auto-detects which terminal you're using (eg. Putty, Xterm, Konsole). It does its job solely by communicating with the terminal via escape codes, so it's much more reliable than $TERM, and connecting remotely never causes a problem.