Screen is a full-screen window manager that shares a physical terminal with other processes (which are usually other terminals/shells). It is normally used when no other manager or desktop is available, such as on a server. It has a scroll-back history buffer and also allows for copy and paste of text between windows.
The following is a brief list of some of the many key bindings available with Screen:
Ctrl + A + ?: It displays a list of commands and their key bindings
Ctrl + A + C: It brings up a new window
Ctrl + A + D: It detaches a window
Ctrl + A + N: It is used to go to the next window in the sequence
Ctrl + A + P: It is used to go to the previous window in the sequence
Ctrl + A + # (where # is a number): It is used to go directly to that window
Ctrl + A + ": It shows the list of windows; user can select any one by the number
The following is a list of frequently used commands:
screen -list
: It shows all of the windowsscreen <program>
: It creates a new window and run that program in it
An example of running the Screen utility is as follows:
In a terminal run the
screen -L
command.Now press Ctrl + A and then press C. This will create another window.
Do this two more times.
Try typing Ctrl + A + 0.
Try Ctrl + A + 3.
In the previous section, step 1 will create a new window, window 0
. If you are running inside a window manager you may notice the title change showing which window it is.
Step 2 will create another window. After step 3, you will have 4 windows in total.
When you perform the actions in step 4, you should be in window 0
. Typing Ctrl + a + 3 will take you to window 3
.
Here is a helpful hint, if you are running only a command line with no desktop, you may want to change your PS1
variable to something like the following in your .bashrc
file:
export PS1="screen$WINDOW \h \u \w \$ "
Now the prompt will always show which window you are in.
This describes only a small part of what Screen can do. Consult the man
page for more information.