Setting up GNU/Screen

Install

debian

apt install screen

slackware

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

System-wide setup

# netbsd
#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 # new file
deflogin off
vbell on
defutf8 on
utf8 on on
startup_message off
caption always "%-Lw%{= bW}%50>%n%f* %t%{-}%+Lw%< | %H %l %c:%s"
defscrollback 65000
shelltitle ""

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

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

keep the default screen TERM otherwise irssi layout cripples

#term xterm

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

user=WHEELED
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/*"

Operations

To name a screen SESSION,

screen -S SESSION_NAME

To rename a screen SESSION,

^a :sessionname SESSION_NAME

Resources

https://unix.stackexchange.com/questions/373115/maximum-scrollback-size-of-screen-window-manager

https://quadpoint.org/articles/irssi/#utf-8-in-irssi-and-screen


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun