Quick guide to gnu-screen
GNU Screen has been around for more than twenty years but it's still a very powerful tool that can save a lot of time and frustration. It basically does two things:
- Allows separation between programs and the shell that started them.
- Allows several terminal sessions in the same window/remote session.
These innocent features open up a ton of possibilities. But the most common uses I give are:
- Working on a remote machine over an unreliable network connection.
- Leave some machine working on a long task (i.e. compilation/download) and carry on later from somewhere else.
- Sharing a console for extreme programming, help-desk, etc.
How it works
When you launch screen it just opens a new shell. You can detach from it with
^A ^D and reattach later with
screen -r or
screen -x. While you're
attached the typical commands you'll need are:
^A ^D -- Dettach ^A ^W -- Window list ^A ^C -- Create new window ^A [0-9] -- Go to window ^A SPACE -- Next window ^A P -- Previous window ^A ^A -- Previous active window
screen -list # list available screens screen -r # reattach to a dettached screen screen -x # attach to a not dettached screen (multi display mode)
Debian has multiuser mode disabled by default for security reasons, but you can enable it like this:
chmod u+s /usr/bin/screen chmod 755 /var/run/screen
After that you can share a screen by enabling multiuser mode and giving access to others user:
^A:multiuser on ^A:acladd someuser
Then the other user can login and attach to the screen:
screen -x youruser/
Byobu: decoration for your screens
Byobu is a set of profiles and configurations for
screen. It adds a status
bar, some menus and support for 256 colors (yes vim schemes work :). Just
install the package and call
byobu instead of
screen when you want the
aptitude install byobu-extras