Virtual Terminals
in Linux it is quite common to have virtual terminals or mulitplexer, which allows to have multiple terminal sessions in one window. This is similar to the nohup
command which does not send a "hangup" (SIGHUP) signal, therefore continues to run. Running a VNC-Session is similar but is used for graphical applications mainly.
There are especially tmux and screen that are widely used on HPC or servers.
Although tmux and screen work similarly, it shall be noted that tmux os prefered.
TMUX
There are a lot of specific things that can be done with tmux, but here are some examples on how to use it. Please also refer to the keybindings.
List all tmux session for your user:
Text Only | |
---|---|
1 |
|
Text Only | |
---|---|
1 |
|
exit
you will leave the session and terminate it as well. If you want the session to continue, you have to use CTRL+b
then push d
for detach. So the CTRL+b
puts you into command mode similar to a VI command mode, and then you can issue commands. Please refer to the keybindings to get more information.
Connect to an existing Session named imgw:
Text Only | |
---|---|
1 |
|
Terminate all tmux session for your user:
Text Only | |
---|---|
1 |
|
A useful feature is to create a split screen in tmux. so inside a tmux session switch to command mode (CTRL+b
) and push "
for horizontal split or %
for vertical split. Moving between splits or here called panes can be done in multiple ways, but easily with CTRL+b
and the arrow-keys
enable mouse srolling and a longer history, write to ~/.tmux.conf
:
Text Only | |
---|---|
1 2 |
|
Tmux inside JupyterLab on TeachingHub
By coincidence the Jupyterlab uses the same control sequence to toggle the file browser in jupyterlab as tmux. CTRL+b
.
To change that, we will just remove the jupyterlab shortcut. In Jupyterlab go to Settings, Advanced Settings Editor, Keyboard Shortcuts. In the user pane add this:
YAML | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
When you can click then save button on the upper right corner, you are fine. Otherwise there might be a syntax error, as indicated in the lower right corner. That might happen if you need to merge things. Now you should be able to control tmux again inside the jupyterlab.
Sharing a tmux session with other users?
In the first terminal, start tmux where shared is the session name and shareds is the name of the socket:
Text Only | |
---|---|
1 |
|
Text Only | |
---|---|
1 |
|
Text Only | |
---|---|
1 |
|
After finishing sharing it is highly recommanded to remove the device with
Text Only | |
---|---|
1 |
|
This has been used on VSC4, SRVX1, JET.
SCREEN
There are a lot of specific things that can be done with screen, but here are some examples on how to use it. Please also refer to the keybindings.
List all screen session for your user:
Text Only | |
---|---|
1 |
|
Text Only | |
---|---|
1 |
|
exit
you will leave the session and terminate it as well. If you want the session to continue, you have to use CTRL+a
then push d
for detach. So the CTRL+a
puts you into command mode similar to a VI command mode, and then you can issue commands. Please refer to the keybindings to get more information.
Connect to an existing Session named imgw:
Text Only | |
---|---|
1 |
|
Sharing a screen session needs to be allowed by root.
Not available on any IMGW system.
Created: January 26, 2023