I have a network simulator (mininet) which simulates switches and hosts for me. I can xterm switches in order to send packets.
I want to print the the "xterm title" in the terminal. For example the xterm title is "Node:s1"(root)
, I am searching for a command that print "Node:s1(root)" in the xterm named "Node:s1"(root). Do you know any command that can print the xterm title?
If that's xterm
, you can do this. Other terminals may have the relevant code disabled (permanently), but with xterm
, you can configure it and get the title string. In the manual page, that is the allowWindowOps
resource.
xterm
(and similar programs) let an application set the title by sending an escape sequence to it. There is another escape sequence which asks the terminal to send the title string back to the host. If the host is not expecting that, and if the string contains commands, your shell will execute those commands.
The place to start reading is the xterm title HOWTO.
Newer versions of xterm
have a different feature for applications that merely want to set the title and restore it. That accounts for most applications that set the title, such as GNU screen. It happens that GNU screen can use this newer xterm
feature. It's only been around 6 years (November 2009), so other programs have not caught up.
Further reading: