Setting up GNU/Screen



slackpkg install screen utempter
mkdir /etc/skel.dist/
mv /etc/skel/.screenrc /etc/skel.dist/

System-wide setup

#cp /usr/pkg/share/examples/screen/etcscreenrc /usr/pkg/etc/screenrc
#ln -s /usr/pkg/etc/screenrc /etc/screenrc

mv -i /etc/screenrc /etc/screenrc.dist
#grep -vE '^[[:space:]]*(#|$)' /etc/screenrc.dist > /etc/screenrc
vi /etc/screenrc #newfile

deflogin off
vbell on
term xterm
#defutf8 on
#utf8 on on
startup_message off
caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< | %c:%s | %l"
defscrollback 65000
shelltitle ""

# fr keyboard alt+, alt+;
#bindkey ^[, prev
#bindkey ^[; next

# us keyboard alt+, alt+.
bindkey ^[, prev
bindkey ^[. next

and eventually enable UTF-8.

other key bindings

#console F9, F12
bindkey ^[[20~ prev
bindkey ^[[24~ next

other values allowed for caption

caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %{=b BW} %H %{-} %l %Y-%m-%d-%c"
%D e.g. Thu
%M e.g. Sep
%d e.g. 05
%c e.g. 12:38

Additional notes

Setup wheeled specific log views

su - $user
vi .screenrc

note. need to use sh -c for wildcards

on CentOS,

screen -t "log" 0 tail -n 100 -F /var/log/messages
screen -t "mail" 1 tail -n 100 -F /var/log/maillog
screen -t "selinux" 2 tail -n 100 -F /var/log/audit/audit.log
#screen -t "web" 3 sh -c "tail -F /var/log/nginx/*.log"
#screen -t "access" 3 sh -c "tail -n 100 -F /var/log/httpd/*access*log"
#screen -t "error" 4 sh -c "tail -n 100 -F /var/log/httpd/*error*log"

on Ubuntu,

screen -t "log" 0 tail -n 100 -F /var/log/syslog
screen -t "mail" 1 tail -n 100 -F /var/log/mail.log
#screen -t "web" 2 sh -c "tail -F /var/log/nginx/*.log"
#screen -t "access" 2 sh -c "tail -n 100 -F /var/log/apache2/*access*log"
#screen -t "error" 3 sh -c "tail -n 100 -F /var/log/apache2/*error*log"

plus on Ubuntu Desktop,

screen -t "all" 3 sudo su -l -c "tail -n 0 -F /var/log/*"
screen -t "root" 4 sudo su -
screen -t "sys" 5

on Debian,

screen -t "log" 0 tail -n 100 -F /var/log/messages
#screen -t "exim" 1 tail -n 100 -F /var/log/exim4/mainlog
screen -t "mail" 1 tail -n 100 -F /var/log/mail.log
#screen -t "web" 2 sh -c "tail -F /var/log/nginx/*.log"
#screen -t "access" 2 sh -c "tail -n 100 -F /var/log/apache2/*access*log"
#screen -t "error" 3 sh -c "tail -n 100 -F /var/log/apache2/*error*log"

on Slackware,

screen -t "log" 0 tail -n 0 -F /var/log/*
#screen -t "nginx" 3 sh -c "tail -F /var/log/nginx/*.log"

#screen -t "messages" 0 tail -n 100 -F /var/log/messages
#screen -t "syslog" 1 tail -n 100 -F /var/log/messages
#screen -t "mail" 2 tail -n 100 -F /var/log/maillog

for NGINX with the /usr/local/nginx/ from scratch default prefix,

#screen -t "access" X sh -c "tail -n 100 -F /usr/local/nginx/logs/*access*log"
#screen -t "error" X sh -c "tail -n 100 -F /usr/local/nginx/logs/*error*log"

and eventually some other shit,

#screen -t "postfixprod" 4 docker exec -ti postfixprod tail -F /var/log/mail.err /var/log/mail.log
#screen -t "mongo" 1 tail -n 100 -F /var/log/mongodb/mongod.log
#screen -t "tomcat" 2 sh -c "tail -F /var/log/tomcat8/*"


To name a screen SESSION,


To rename a screen SESSION,

^a :sessionname SESSION_NAME


maximum scrollback size of “screen” window manager