Tmux Common Commands
July 26, 2022 · 1 min read
If you have any questions, feel free to comment below. Click the block can copy the code.
And if you think it's helpful to you, just click on the ads which can support this site. Thanks!
A tmux instance can contain multiple sessions, a session can contain multiple windows, a window can contain multiple panes, and a shell dialog is opened in each pane.
- Press ctrl + b and release it, then press
%: split the current pane into two panes side by side. - Press ctrl + b and release it, then press
": split the current pane into two panes stacked vertically. - Ctrl + d: close the current pane; if all panes in the current window are closed, the window closes automatically; if all windows in the current session are closed, the session closes automatically.
- Click with the mouse to select a pane. (Set up yourself)
- Press ctrl + b and release it, then press an arrow key: select an adjacent pane.
- Drag the divider between panes with the mouse to resize it. (Set up yourself)
- Hold ctrl + b while pressing an arrow key to resize the divider between panes.
- Press ctrl + b and release it, then press z: maximize/restore the current pane.
- Press ctrl + b and release it, then press d: detach the current session.
tmux a: reopen a previously detached session. (You can also use the full commandtmux attach)- Press ctrl + b and release it, then press s: select another session.
- Up arrow: select the previous session/window/pane
- Down arrow: select the next session/window/pane
- Right arrow: expand the current session/window
- Left arrow: collapse the current session/window
- Press ctrl + b and release it, then press c: create a new window in the current session.
- Press ctrl + b and release it, then press w: select another window, using the same method as for sessions. (The difference is that the unit is a window)
- Press ctrl + b and release it, then press PageUp: scroll through the content of the current pane.
- Mouse wheel: scroll through the content of the current pane.
- When selecting text in tmux, hold down the shift key. (Only supported on Windows and Linux, not Mac, but this operation is not necessary, so it does not matter much)
- The general way to copy/paste text in tmux:
- Press ctrl + b and release it, then press [
- Select text with the mouse; the selected text is automatically copied to the tmux clipboard
- Press ctrl + b and release it, then press ]; the contents of the clipboard will be pasted at the cursor
Related readings
If you want to follow my updates, or have a coffee chat with me, feel free to connect with me: