Multiply your productivity by using a terminal multiplexer.
Yes, I know. It also exists tmux but I flipped a coin and (by now ^:) chose GNU Screen.
Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).
Take a tour
Run all commands in this section to take a tour of basic screen usage.
Start with a simple screen customization, create a ~/.screenrc with the following content
vbell off # Turns visual bell off shell -$SHELL # load shell profile
To start screen, just launch
Display help with CTRL-a ?.
All screen commands are prefixed by CTRL-a, written in the help as
You can give a name to the session
$ screen -S mySecondScreenSession
List running sessions
$ screen -ls There are screens on: 16704.mySecondScreenSession (Attached) 16562.pts-3.server01 (Attached) 2 Sockets in /var/run/screen/S-user.
Detach from current session with CTRL-a d.
Attach to a running session
$ screen -x pst-3
Suppose you need to login as user1 in some host, then you can switch to user user2, user3 … userN.
As user1 start a named screen session and switch to user2
$ screen -S user2 $ su - user2
then detach with CTRL-a d and you are back to user1 session.
Repeat the analogous commands for user3, till userN.
You get a screen session for every user. Now you do not need to enter passwords again and if the connection is broken you can enter again as user1 then go to user2 with
$ screen -x user2
Enter in some screen session or create a new one, for instance
screen -x multiWindowSession
Create a new window with CTRL-a c. Cycle through windows with CTRL-a n or even better with CTRL-a CTRL-a i.e. holding CTRL and hitting a twice. Close window with CTRL-d.
Resize split window
Split window with CTRL-a S. It creates a new region below.
Go to new region with CTRL-a TAB.
The region is empty, create a new window inside it with CTRL-a c
Resize region by entering a screen command with CTRL-a :,
then type for example
resize -5 to reduce region height by five rows.
This is very useful if you want a separated window where you launch tasks like running tests, watch files for changes, tail logs, etc.
Remove dead screens
If there are dead screen session you can clean them with