A brief guide to Screen

@screen@ is a very useful utility if you work in a terminal window. It lets you open multiple “windows” within your terminal session, and lets you detach from a session and come back to it later. screen is installed as standard in some Linux distributions, but you might have to install a package for it.

To get started, type screen – this brings up some introductory text, which you get out of by hitting space or enter. You then end up back at your shell prompt, except now it is within screen.

Commands to screen all start with ctrl-a and are followed by another character. There are lots, but I get by fine with just these ones:

ctrl-a c – create a new “window”.

ctrl-a n – switch to the next “window”. Once you have multiple windows open, use this to switch between them. There are other ways of switching windows, but I just use this.

To close a window, you just finish what you were doing with it and log out of the shell in the normal way. If you close the last window in a session, the session will end.

ctrl-a d – detach from the screen session. This leaves the windows and everything that was running in them running in the background, but you can now log out of your terminal and come back to it later.

ctrl-a ? – shows all the key bindings. But as I’ve said, I get by with just the ones I’ve mentioned.

If you have a previous session that you want to come back to, start screen with screen -r and it will ‘reattach’. If you have multiple existing sessions, this will give a list and tell you how to choose one to connect to. Unfortunately they are only distinguished by process ID, which is not very informative.

Post a Comment

Your email is never published nor shared. Required fields are marked *