A practical look at the Screen terminal multiplexer

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Scripting

Screen can also be controlled by scripts, which means that commands can be sent to separate sessions at Screen startup or later at the command level. For example, using

$ screen -X stuff "ls -lh\r

would run the ls -lh command in window 0 of the session. Screen needs you to specify the final carriage return (\r ) to execute the command. If you want to control another window, use the -p option followed by the name or number of the window.

You can also pass Screen commands to open sessions. The command

$ screen -p 2 -X kill

would shut window 2 of the Screen session, or

$ screen -X multiuser on

would make a session multiuser. With multiple Screen sessions running, you can specify which session you want to send a command to with the -S <pid> parameter.

Conclusion

For admins who use the command line often, using Screen can make work easier in many ways. Of course, this applies to other terminal multiplexers as well, but Screen, unlike Tmux, still basically uses the key bindings that were once common used in many serial console programs.

Screen has a huge range of functions, although some are rarely used in practice. In any case, a glance at the documentation helps you see what's available and what might come in handy later on.

Installation

GNU Screen is usually quick to install. On Debian and derivatives such as Ubuntu or Linux Mint, you can install the multiplexer with

$ sudo apt-get install screen

Users of Arch Linux can do this with

# pacman -S screen

To install the newest version [3], however, you can't avoid using the classic ./configure; make; sudo make install trio.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content