views:

959

answers:

5

I like to keep my shell sessions named with useful titles as I work, this helps me keep track of what I'm using each of the many tabs for.

Currently to rename a session I double click its name on the tabbed part of the console - is there any command that I can use to do this from within the shell? It would save me a bit of time.

thanks in advance

edit :- I am using KDE's Konsole shell.

+4  A: 

The article How to change the title of an xterm should help.

Greg Hewgill
I've managed to change the title of the command line using a method suggested in here, however it doesn't change the title of the tab for the session at the bottom of the terminal. Any ideas how to do this would be great.
Scottm
I suppose the method to change the title of the tab would be specific to whatever terminal program you're using.
Greg Hewgill
+1  A: 

The answer to this really depends on the terminal program you're using.

However, I'll just assume it's sensible, and emulates an xterm enough that it respects xterm escape codes - in which case, you probably want to look here : http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3

Note: unwind's example below requires echo to be called like this "echo -ne", otherwise the '\' characters are echoed literally.

GodEater
+1  A: 

According to this page, you should be able to use something like this:

echo -n "\033]0;New Window Title\007"

I'm not in Linux at the moment, so this is untested. I do know that it is possible to change the window title under program control, so this seems likely to work.

unwind
You may need -e depending on your shell / profile.
Anders Eurenius
you need to have -ne
dsm
+1  A: 

Currently to rename a session I double click its name on the tabbed part of the console

This sounds like you're using KDE's Konsole. Is this true?

If so, in KDE 3:

dcop $KONSOLE_DCOP_SESSION renameSession "I am renamed!"

In KDE 4, the old DCOP interfaces haven't been ported over to the new D-BUS IPC yet, but you can change the settings for tabnames to follow the window name set by each screen, and set the window name as described by the other answers.

ephemient
This worked exactly as I wanted - thank you very much :)
Scottm
A: 

hi ephemient, thankx for reply : "dcop $KONSOLE_DCOP_SESSION renameSession "I am renamed!" It worked..

pekon