Screen Tips


Screen is a nice utility to multiplex several consoles over a single connection to a remote machine.

Besides allowing us to switch between as many consoles as we want over a single connection, screen also remains running even after logging out, thus making it possible to leave programs running on the remote computer without having a permanent connection.

Screen has many other features like copy/paste of text between any consoles on same screen, if for some reason you aren't able or don't want to use the mouse.

Below is the list of commands I find most useful for every day tasks on screen and settings to enable a status line that will inform you of how many consoles you have along with the machine id and date/time.


Reattach to a previously running screen
  • screen -d -RR
    • My favorite, select first running screen, reattach here and detach any previous running connection to it. If no screen exists, create it first
  • screen -list
    • Check and list all screens running on the current user so you can choose which one to attach to.
  • screen -d -r pid.screen-name
    • Detach and reattach to the screen named "pid.screen-name". These names come from screen -list.


Command key reference


Status line

Place the next two lines into ~/.screenrc to enable a status line.

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}]'



Here's how it looks like with the status line configured as presented above:


To learn more about screen, read the online manual at

I hope you find this short introduction helpful!

Published on Monday 2013/04/29, last modified on Tuesday 2013/04/30