Changing the Terminal Window Title Text To change Linux (and perhaps other systems) Terminal windows' titles, you must use escape codes as follows: printf "\e]2;YOUR TITLE GOES HERE\a" If you execute this in a terminal session, it will change the title of the terminal to “YOUR TITLE GOES HERE” If you omit a title string (i.e. use printf "\e]2;\a" ), the title will default to “Terminal”. Correcting PS1 From Resetting The Title There is one situation in which the above may seem not to work: when the screen title is set within the Unix prompt construction. How The Unix Terminal Prompt is Set The in a Shell , the PS1 environment variable controls what texts is shown at the prompt. Every time a shell command completes and the prompt is shown, PS1 is evaluated. Since it is a shell variable, anything that can be done in the context of shell variables is possible with the PS1 prompt - in fact arbitrary shell code is possible to be run dur...
Comments
Post a Comment