Screen usage on linux and unix systems

Working on linux and unix systems you every now and then need to leave something running overnight or so. Screen is the tool for this.

Basic usage of screen is easy but there is though few tricks you might need after initial start.

If you use screen after you have done eg. sudo su – commonappsuser you might end up nasty Cannot open your terminal ‘/dev/pts/nn’ – please check type of errors. What you would do here is to run script /dev/null and after that you can use eg. screen -rD to detach that previous session.

If you got after screen -rD There are several suitable screens on: message, you can use just that Deteached string after the -rD to connect to right session.

While you are in screen you might need following basic ctrl key combinations to go around.

C-a C-c     (screen)      Create a new window with a shell and switch to that window.
C-a C-a     (other)       Toggle to the window displayed previously.
C-a C-n     (next)        Switch to the next window.
C-a C-p     (prev)        Switch to the previous window (opposite of C-a n).
C-a "       (windowlist -b) Present a list of all windows for selection.
C-a A       (title)       Allow the user to enter a name for the current window.
C-a C-d     (detach)      Detach screen from this terminal. (exit)
C-a S       (split)       Split the current region into two new ones.
C-a tab     (focus)       Switch the input focus to the next region.

There are a lot more commands, just read those + basic stuff from man screen.