GNU Screen Basic Tutorial Posted on May 26, 2009 by Dave Fowler
If you've ever SSHed into a server, ran something, logged off and got frustrated because whatever you were running stopped running because you had to change coffee shops or go to class then you've experienced the need for GNU Screen.
Put simply it allows you to maintain a persistent session, a terminal that does not change or quit just because you logged out. Installation is easy. On a debian machine its simply
sudo apt-get install screen
Usage is straight forward as well. Type the word "screen"
$ screen
and you'll be shown a welcome window, press space to get through. Now you'll simply see a standard shell. You can execute whatever you want here and the session will not die until you tell it to. You can start many different sessions and toggle between them. Here's a table of the basic controls for screen.
- Ctl-a Ctl-c, create a new window
- Ctl-a Ctl-a, switch between windows
- Ctl-a n, toggle to next window
- Ctl-a p, toggle to previous window
- Ctl-a 5, toggle to 5th window
- Ctl-a ", get a menu listing all of the window
- Ctl-a A, tool for adding a name to your window, helpful for the menu view
- Ctl-a k, Kills the window
- Ctl-a d, Detach from the session
Another thing to note. Once you detach from a screen, you need to re-attache the next time you run screen. To do that simply specify the -r parameter.
$ screen -r
Update 6-3-2009: A few fixes were made thanks to Ben Finney's comments