Screen

From Notes

Jump to: navigation, search

For help at any time, issue the following command:

C-a ?

View running screen sessions:

screen -list

To start a process in a screen session and detach it immediately, execute screen with the following parameters:

screen -d -m <process>

To re-attach to a screen process, execute the following command:

screen -d -r <PID>

To enter an attached screen session, execute the following command:

screen -x <PID>

To detach from a screen session that you are in, issue the following sequence:

  1. C-a c
  2. screen -d <PID>

To scroll back in the buffer, execute the following commands:

Ctl-a <ESC>

...you can then use typical vi commands to scroll back and forward.

.screenrc

The configuration file for screen is .screenrc, located in your home directory. Some useful options that I have set are:

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Default screens
screen -t root 0
screen -t aux1 1
screen -t aux2 2
screen -t aux3 3
screen -t aux4 4

What this does is start up screen with 5 active sessions, labeled root and au1 - 4, along with a status bar at the bottom that I find pretty useful.

Personal tools