- Workflow management: Tired of opening the same directories / windows / panes when working on a project? You can save it all to a session and return at any time.
- Terminal window and pane management (handy when using vim)
- Session management: run time-consuming terminal processes in one session, and go do other stuff in other sessions
brew install tmux
You can configure all of your tmux settings in ~/.tmux.conf
. If it doesn't exist, go ahead and create it.
By default, the prefix for all tmux commands is CTRL+B. However, many people switch the prefix to CTRL+A because they find it easier to type.
Here's are some things in my .tmux.conf file I find helpful:
unbind C-b
set -g prefix C-a
changing the prefix over to CTRL+A
bind-key C-a last-window
cycle between you last windows by using your prefix twice
https://blog.no-panic.at/2015/04/21/set-tmux-pane-title-on-ssh-connections/ Label your tmux panes with the remote servers you're connected to
Here's a quick way to see what's possible with tmux:
-
Launch Terminal
-
Type
tmux new -s some_project_name
to begin. This creates a new session for a project you're working on. -
Let's divide your current window up into three panes: - split vertically by typing in
prefix %
- next, split horizontally withprefix "
You could just split panes into panes back and forth forever.If you get overwhelmed, you can kill your pane with
prefix x
-
Move between panes with
prefix {arrow_key}
Try navigating to different directories in each pane. -
Create a new window with
prefix c
. You'll notice that a new number has appeared on your tmux bar. You can switch to the corresponding window withprefix 0
,prefix 1
, etc Switch between your last two windows withprefix prefix
Each window can be configured with its own panes. -
Now let's exit this session and create a new one. Type
prefix d
to detach from your current session. -
Create a brand new session with
tmux new -s another_project
-
Here's where you'd set up your panes / windows / and processes for another_project.
-
Leave this session with
prefix d
-
See all of your available sessions with `tmux ls`
-
Check out an existing session with `tmux a -t session_name`