Now that we’ve installed tmux, the terminal multiplexer, how do we use it?
- Start your project from your shell
In the terminal, I navigate to the directory containing my project.
- Start a new tmux session
tmux new -t <project-name>
I usually name the tmux session after the project directory to avoid confusion.
For example, if the project folder is called flask-react-auth
, I create a new session with: tmux new -t flask-react-auth
.
The tmux session looks almost the same as the standard terminal. I now open a few tmux panes. Most of the time, the main “window” contains my Vim session, and a secondary smaller pane is for running shell processes.
You can open new panes with <prefix>%
and <prefix>=
.
(The standard prefix key mapping is CTRL+B
.)
- Detach from the session
If you’re finished with your work, you can detach from the tmux session.
tmux detach
Or run <prefix>d
. (The standard prefix key mapping is CTRL+B
.)
If you use tmux-continuum, your session will be saved automatically.
You can easily jump back into the session with tmux attach -t <project-name>
.
See a list of current tmux servers with tmux list
.
- Some other tricks
You can open a new tmux window with <prefix>c
.
You can see a list of all panes and windows with <prefix>w
.