Linux: Screen configuration

From Luky-Wiki
Revision as of 18:53, 13 February 2016 by Lukas Dzunko (talk | contribs) ("hardstatus")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Screen is very useful tool for Linux. It give ability to have more that one "window" (screen) within one terminal session. Additionally it have ability to leave "screen" running in background after log-off from system. Unfortunately default configuration have one catch especially for newbies. There is no information bar which show number of "windows" and details about them. Status line can be added by hardstatus command or statement in configuration file.


I am using following additional configuration of screen in /etc/screenrc:

# cool status line and unicode support :o)
hardstatus alwayslastline "%{ck}%?%-w%?[%n*%f %t]%?%+Lw%?%=| %c - %d.%m.%Y %D | %H %l |"
defutf8 on

Note: This can be also temporary configured via command mode (C-a :) but due to limitation of command mode terminal should be at least 90 characters wide. (Screen will accept it only if there is enough space to enter it in single line)

Example of status line (last line in terminal):

[0*$ bash]  1-$ bash  2$ bash         | 15:48 - 08.11.2013 Fri | hekate 0.08 0.07 0.11 |
  • Left part show number of window / selected window (number with * and brackets) / previous window (number with dash)
  • Middle part (aligned to right) show Time - Date and name of day in week
  • Right part show hostname (just to be sure that it is running on correct host) and equivalent of "load avg" output

Window can be renamed using C-a A.

Here is example of lastline with window name (title) in place:

0 syslog  1 nagioslog  [2*$ update]   | 15:55 - 08.11.2013 Fri | hekate 0.25 0.21 0.16 |