tmux Is Great
What Is tmux?
tmux is a terminal multiplexer. It allows you to run multiple terminals within a single terminal window and work on them in parallel.
If installed on the server side, it can also be used from the client side over an SSH connection.
Furthermore, tmux allows you to detach sessions (similar to screen), so you can end your SSH connection without stopping a training process.
It is also useful when you want to monitor tensorboard while doing other work — instead of creating multiple SSH sessions, you can split a single session.
tmux Structure
- Session: The entire terminal managing one or more windows
- Window: A terminal within a session that manages one or more panes
- Pane: A single terminal split within a window
Shortcuts
There are a huge number of shortcuts, but there is a well-organized article you can reference as you go.
Customization
tmux is configured via ~/.tmux.conf. By modifying ~/.tmux.conf, you can change key bindings and other settings.
Here are two recommended articles from Qiita:
Usage
The basics are:
- Start
tmux
- Quit
tmux kill-session
- Detach (leave while keeping code running)
prefix d
- Attach (reconnect to the previous session)
$ tmux a
That's it.
By the way, when connecting through multi-hop SSH, start tmux from the server one hop before your final destination.
For example, I use GPUs through a bastion server, so I start tmux from the bastion server.