screen on Linux

After installing screen you can have multiple sessions per ssh connection and they can be resumed if the connection is lost.

type screen to start

Now open a new window with “Ctrl-A” “c”

You can create several windows and toggle through them with “Ctrl-A” “n” for the next window or “Ctrl-A” “p” for the previous window

You kill the window with “Ctrl-A” “K” or “exit” will work on some systems.

If you get disconnected you can reattach:

screen -ls
There is a screen on:
24055.pts-3.server-1    (Attached)
1 Socket in /tmp/uscreens/S-myname.

to reattach:

screen -r 24055.pts-3.server-1

Using “Ctrl-A” “H”, creates a running log of the session

Screen can monitor a window for activity or lack thereof. This is great if you are downloading large files, compiling, or watching for output. If you are downloading something or compiling, you can watch for silence. To start the monitor, go to the screen you want to monitor and use “Ctrl-A” “M” to look for activity or “Ctrl-A” “_” to monitor for silence. Then open or switch to a new window. When the monitor detects activity or silence, you will get an alert at the bottom with the window number. To quickly go to that window, use “Ctrl-A” ” (thats a quote mark, ctrl-a then a “). After you do this, just type in the number of the window and enter. To stop monitoring, go to that window and undo the monitor with the same command. For example, to stop monitoring for activity you would use “Ctrl-A” “M” again.

You can leave a response, or trackback from your own site.

Leave a Reply