Tmux/GNU Screen
Last updated
Last updated
Tmux is the best command-line screen manager. Screen is its predecessor.
Tmux/screen lets you tile window panes in a command-line environment (see the screenshot below). So that you can run, or keep an eye on, multiple programs within one terminal; and minimize (detach) them when you close the connection, and restore them back in afterwards (reattach).
A common use-case is when you interactively train a model on a GPU node, or donwload large files on a transfer node. These tasks take a long time, and you may want to keep them running when you close the SSH and leave office. Tmux/screen allows you to run model training and data download in a specifc "container" of command-line apps, such that you can minimize/detach them when you close the SSH, and open/reattach them when you are back and quickly check their running status.
Another common use-case for tmux/screen is on a remote server where you have a common layout that you always use (say, Vim + IPython), and want a way to quickly jump into and out of. An example would be if you’re connecting through a login server and have other remote SSH sessions you would like to be connected to simultaneously. Similarly, if you have to hop into Vim, you can use tmux to give you access to your shell or a REPL in the same terminal window for a IDE-like experience.
By default screen is available on the 2013 Cisco cluster, and both tmux and screen are available on the 2022 HPE cluster. You can install a local version of Tmux on Cisco cluster. Because Tmux is almost better than Screen on every aspect, we will focus on Tmux; but GNU screen usage should be highly similar if you just google it.
tmux new -s [session name]
ctrl+b d
tmux ls
tmux a -t [name of session]
tmux kill-session -t [name of session]
ctrl+b "
ctrl+b %
ctrl+b x
ctrl+b [arrow key]
Tmux cheatsheet: https://tmuxcheatsheet.com/