This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
title_examples [2005-03-04 14:50] 192.168.1.192 |
title_examples [2021-02-19 19:49] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Title Examples ====== | ||
+ | Each screen window has a title. | ||
+ | |||
+ | You can set the default title for your windows with the '' | ||
+ | |||
+ | ===== Simple examples ===== | ||
+ | |||
+ | In .screenrc, set the default title of all windows to " | ||
+ | |||
+ | < | ||
+ | shelltitle " | ||
+ | </ | ||
+ | |||
+ | In .screenrc, from screen' | ||
+ | |||
+ | < | ||
+ | screen -t anise | ||
+ | </ | ||
+ | |||
+ | The escape sequence can be used from any program to set the title. | ||
+ | |||
+ | < | ||
+ | echo -ne ' | ||
+ | </ | ||
+ | |||
+ | a bash shell prompt: | ||
+ | |||
+ | < | ||
+ | export PS1=' | ||
+ | </ | ||
+ | |||
+ | and, just for fun, Emacs Lisp: | ||
+ | |||
+ | < | ||
+ | (send-string-to-terminal " | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Setting the title to the host you ssh'd into ===== | ||
+ | |||
+ | A nice solution may be found at http:// | ||
+ | |||
+ | See also http:// | ||
+ | |||
+ | |||
+ | ===== Setting the title to the name of the running program ===== | ||
+ | |||
+ | A common desire is to name one's windows after the programs running in them. A window sitting at a shell prompt might be named " | ||
+ | |||
+ | If you're running tcsh or zsh, you have the easiest time of this. Both of those shells define a special symbol that is run after a command is entered. | ||
+ | |||
+ | < | ||
+ | alias postcmd 'echo -ne " | ||
+ | </ | ||
+ | |||
+ | On non-Linux systems like (Free)BSD or Solaris you may use the POSIX version with printf: | ||
+ | < | ||
+ | alias postcmd ' | ||
+ | </ | ||
+ | |||
+ | In zsh, it's the shell function '' | ||
+ | |||
+ | < | ||
+ | preexec () { | ||
+ | echo -ne " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Other shells have no such feature, but screen has heuristics to fake it. You have to tell screen what the end of your prompt looks like, and let it know when you're sitting at a prompt. | ||
+ | |||
+ | Here's a concrete example. | ||
+ | |||
+ | < | ||
+ | shelltitle "$ |bash" | ||
+ | </ | ||
+ | |||
+ | and this in your .bashrc or .profile: | ||
+ | |||
+ | < | ||
+ | export PS1=' | ||
+ | </ | ||
+ | |||
+ | Please note the use of single quotes. Also, if you want to use it with a bash prompt that spans several lines you have to put it on the last line. For example: | ||
+ | |||
+ | < | ||
+ | export PS1=' | ||
+ | export PS1=" | ||
+ | </ | ||
+ | |||
+ | As a special case, if the //< |