screen
commandSessions on the head node or the interactive nodes can be persisted even if your local computer disconnects from keeling. This is accomplished using the screen
command.
To start a screen session, simply type screen
in your console:
user@keeling ~$ screen
This will open a screen session, create a new screen session, and start a shell in that window.
Now that you have opened a screen session, you can get a list of commands by typing:
Ctrl+a ?
Named sessions are useful when you run multiple screen sessions. To create a named session, run the screen command with the following arguments:
screen -S session_name
It’s always a good idea to choose a descriptive session name.
When you start a new screen session, it creates a single window with a shell in it.
You can have multiple windows inside a Screen session.
To create a new window with shell type Ctrl+a c
, the first available number from the range 0...9
will be assigned to it.
Below are some most common commands for managing Linux Screen Windows:
Ctrl+a c
Create a new window (with shell).Ctrl+a "
List all windows.Ctrl+a 0
Switch to window 0 (by number).Ctrl+a A
Rename the current window.Ctrl+a S
Split current region horizontally into two regions.Ctrl+a |
Split current region vertically into two regions.Ctrl+a tab
Switch the input focus to the next region.Ctrl+a Ctrl+a
Toggle between the current and previous windowsCtrl+a Q
Close all regions but the current one.Ctrl+a X
Close the current region.You can detach from the screen session at any time by typing:
Ctrl+a d
The program running in the screen session will continue to run after you detach from the session.
To resume your screen session use the following command:
user@keeling ~$ screen -r
In case you have multiple screen sessions running on your machine, you will need to append the screen session ID after the r
switch.
To find the session ID list the current running screen sessions with:
user@keeling ~$ screen -ls
Example output:
user@keeling ~$ screen -ls
There are screens on:
224185.jupyter (Detached)
66327.tunnel (Detached)
90455.oban (Detached)
3 Sockets in /var/run/screen/S-user.
If you want to restore screen 224185.jupyter, then type the following command:
user@keeling ~$ screen -r 224185
or, using the descriptive name you provided with screen -S
user@keeling ~$ screen -r jupyter
screen
usageBasic Linux Screen Usage
Below are the most basic steps for getting started with screen:
screen
. It’s better to name the session with screen -S descriptive_name
.Ctrl-a + Ctrl-d
to detach from the screen session.screen -r
.exit
to end the screen session.