Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-03-2009, 02:34 PM   #1
LQ Newbie
Registered: Apr 2006
Location: Eagan, MN
Distribution: SuSe cuz that's what we run at work when we don't run Solaris
Posts: 11

Rep: Reputation: 1
Cool How to get the Title of a Putty Window (Emulating an XTerm)

I have a Perl script that changes the terminal window title and I would like to be polite and reset it to the original value when I am done. We are using Putty which emulates xterm. We are not running X-Windows so I can't use something like xprop (can I?). I'm using XTerm control codes to change the title and I have found a code that returns the window title ESC[21t; It seems to work except it doesn't go to STDOUT or STDERR. I can see the title, but I need to capture it

Putty has an option: "Response to remote title query (SECURITY)" I would like to know how to make such a query. I understand the security implications, but this is behind a firewall and Putty will not be used on sites in the wild.
Old 09-05-2009, 05:12 AM   #2
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
I use this line to change the window title from my .profile:
PROMPT_COMMAND='echo -ne "\033]0;$USER@${HOSTNAME}: ${PWD}\007"'
Try running echo $PROMPT_COMMAND before running your perl script. If that
variable contains something, run PROMPT_COMMAND_OLD="$PROMPT_COMMAND" before
you run the script and then PROMPT_COMMAND="$PROMPT_COMMAND_OLD" afterwards.


putty, terminal, title, window, xterm

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the title of xterm/gnome-terminal redleafong Linux - Software 6 01-10-2011 06:38 PM
Change title of xterm - Fedora 2.6 sohnir Linux - General 3 12-13-2005 11:40 AM
xterm title after quittin ssh sessions bujecas Slackware 1 07-01-2005 08:27 PM
Rename Putty Title dlublink Linux - General 3 03-10-2005 08:28 AM
custom xterm title when already defined in .bashrc brian0918 Linux - Software 1 06-01-2004 11:17 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration