GuidesThe Many Uses of Screen

The Many Uses of Screen

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




Last week I talked about using cut
and paste within Screen
. You can also use screen for several other useful tricks as well.

Tip of the Trade: There’s much to love about Screen. Besides enabling cutting and pasting, the utility can be used to monitor a window for output, mirror another session, lock the screen and more.

  • Monitor a window for output: Hit Ctrl-A Shift-M when in window 1, and then flip to window 2 (with Ctrl-A N), and you’ll be notified in window 2 when there’s output in window 1. This is useful if you’re running a job that takes a long time; no need to keep flipping between windows. You can also monitor for silence with Ctrl-A _. This is useful if you’re running a compile job or something else that outputs a lot of stuff when it’s running successfully.
  • Use the window list: Hit Ctrl-A ” to see the window list. This is great if you have lots of windows open within screen. To name your windows more helpfully, use Ctrl-A Shift-A while in the window to set its title.
  • Mirror another session: Use screen -x to connect to another existing session, and mirror everything that goes on in it. The existing session will also mirror anything that goes on in the second on. I use this when connecting to the server that runs my email from more than one place at once. It can also be useful for debugging — log in as the user that’s having problems, and connect to his or her screen session.
  • Lock the screen: Hit Ctrl-A X to lock the screen; unlock it using your password.

You can also use the ~/.screenrc file to set persistent options, including to start a set of windows up when screen launches. Check out the manpage and the GNU screen wiki for more.

Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of “Linux System Administration Recipes: A Problem-Solution Approach” (Apress, 2009).

Follow ServerWatch on Twitter

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories