Here’s a quick guide to getting started with the essentials:
Starting and Attaching to tmux Sessions
- Start a new `tmux` session by simply running `tmux` in your terminal.
- After the first time, you don’t need to restart `tmux`. Instead, use `tmux attach` to reattach to any active session.
- If you’re unsure if there’s an active session, use `tmux ls` to list any running sessions.
Basic Commands Inside tmux
- Create New Shells: Press `Ctrl-b c` to open a new shell within your tmux session.
- Switching Shells: Press `Ctrl-b` followed by a number to switch between these open shells (numbered starting from 0).
- Detaching from tmux: Press `Ctrl-b d` to detach from the tmux session, closing your current connection but keeping all shells active in the background.
Loading Modules Within tmux
Each shell within your tmux session is isolated, so you can load software modules as needed. For example, if you do: module load Python/3.11.3-GCCcore-12.3.0 this will apply only to the current shell within tmux
Persistence and Reconnection
One of tmux’s biggest advantages is session persistence. If you disconnect or lose your connection to the server, your tmux session and all active shells within it will remain running. Simply reconnect to the server and use `tmux attach` to continue where you left off.