Ubuntu-ized GNU Screen is Faster and Friendlier
A Short Tutorial
GNU Screen is a terminal multiplexer program that Linux folk have used for ages. It allows you to turn one terminal into many, and run processes even after logging out. In this article we will give a brief overview of screen usage for the uninitiated, then talk about how Ubuntu's defaults and new screen-profiles package have taught us about new and wonderful features of screen.
A Short Tutorial
You will see a flash, then be at a blank terminal. While it may seem that nothing has happened, what you're looking at is actually a new terminal within screen. You can continue as normal, but sooner or later you will wish to run a new terminal. First, let's get familiar with screen.
Pressing the control and a keys simultaneously (which we'll denote with C-a from now on) signals screen to interpret the next command. So if you press C-a and let go, then press 'c' for "create," (C-a c) you will be in a new terminal window. You've created a new window within screen. You can view the list of windows with C-a w. If you exit your shell in the new window, screen will automatically destroy the window and you'll be back to the first. Create a few more and type some random commands in each (different ones in each). You can now press C-a then SPACE to move to the next window. If you press C-a a you will return to the previous window. Also, you can select windows directly by typing the number after C-a.
Lastly, you need to know how to detach and reattach to screen. Press C-a d and screen will exit. You are back at the single terminal you started with, without screen. You can see what screen sessions you have running in the background with 'screen -ls.' Now, to reattach to your screen session, run: screen -x
We use the -x command to reattach so that it can be done multiple times. From your laptop, home computer, and work computer, are the most common. For the rest of the basics, see the screen man page or C-a ?.
Things to Do With Screen
Screen is wonderful for work management. You can have a standard layout of screen windows, each one dedicated to a different server. You will instinctively press C-a 8, for example, when you think about the ssh session that generally lives in that window.
Most often, we will want to do something else while waiting for a long-running command to finish. Easy enough: Just create a new window and carry on. This is also very handy for "leaving." If you ssh to a server from your laptop and start a process or script that takes an extremely long time to complete, you may be stuck. Close your laptop and go home, and the process ends. Of course, you should have run it from your screen session that runs on a server.
Many people also use screen to stay attached to IRC while they are away, and read the chat history of what was missed. Simply run irssi or your favorite IRC client within a screen window, and you're all set.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: Alienware, KDE and Ubuntu 13.04
- 2Linux Top 3: Linux Mint Olivia, Fedora 19's Cat and Ubuntu's Mission Accomplished Moment
- 3GNOME 3.8 Debuts New Open Source Linux Desktop
- 4Linux Top 3: Linux 3.10 Goes Long, Linux 3.11 Advances as LXDE Merges
- 5Linux Top 3: Ubuntu Kaylin, Debian Wheezy and Linux Mint