Customize GNU Screen Terminal Title

  • Posted on: 6 April 2014
  • By: Zhijun Chen

GNU Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.

To install Screen under Ubuntu, open a terminal and type in the following script.

sudo apt-get install screen

After installation, You can customize the terminal titles by creating a .screenrc file under your home directory and put the following code in the file.

termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
termcapinfo xterm ti@:te@
shelltitle '$ |bash'

termcapinfo rxvt 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
termcapinfo rxvt ti@:te@

hardstatus on
hardstatus alwayslastline
hardstatus string "%{wk}%H%{Bk}|%{Mk}%?%-Lw%?%{km}[%n*%f %t]%?(%u)%?%{mk}%?%+Lw%? %=%{Bk}"

The effect of the code above will set the screen display as shown in the following picture.


Some useful keyboard combinations in Screen:

  • ctrl+a -> caps+a : Name the current terminal
  • ctrl+a -> number of window x : Switch to window x, e.g. ctrl+a 1
  • ctrl+a -> ctrl+a : Go back to the previous screen
  • ctrl+a -> [ : Enter copy mode, then you can scroll up and down in the current window, press q to exit
  • ctrl+a -> caps+s : Split display vertically
  • ctrl+a -> | : Split display horizontally
  • ctrl+a -> tab : Jump to next display region
  • ctrl+a -> caps+x : Remove current region
  • ctrl+a -> caps+q : Remove all regions but the current one

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.