The habit of using the terminal has always been to switch tabs through the tab functionality of iTerm2. There is nothing wrong with this approach, but since I learned about the usefulness of tmux
, I have moved all my terminal operations to tmux
. tmux
has several concepts: session, window, and panel. Each window can have multiple panels, and each panel can access different sessions. It is very convenient when working with remote servers.
The keyboard shortcuts in tmux
are quite unique. They all start with <C-b>
combined with other keys. This article records some of the commonly used shortcuts:
Function | |
---|---|
tmux new -s name | Create a new session |
tmux a -t name | When the terminal is closed, tmux retains the session and can be restored with attach |
tmux ls | List the current sessions |
c | Create window |
& | Kill window |
. | Name window |
% | Vertical split (within the same page) |
" | Horizontal split (within the same page) |
x | Kill panel |
, | Rename panel |
z | Temporarily hide other panels |