Timeline
Timeline
2025-10-20
init
This article introduces the installation and basic configuration methods of tmux, including startup settings in a WSL environment and using tpm to manage plugins. At the same time, the article summarizes common shortcuts for session, window, and pane management, and explains how to use copy mode to view history.
tmux installation
1 | sudo pacman -Sy tmux |
If using WSL, you can configure it to start tmux upon launch. Find the Arch Linux command line option in the settings and append it.-- tmux
tmux configuration
Install tpm
1 | git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm |
Configuration file ~/.tmux.conf
1 | # Set prefix key to Ctrl+q |
Then press C-q I to download the packages
Common shortcuts
Session management
| Command/Shortcut | Description |
|---|---|
tmux new -s <name> | Create a new session named name |
Ctrl+q d | Detach the current session (session continues running in the background) |
tmux ls | List all sessions |
tmux attach -t <name> | Reconnect to a specified session |
Ctrl+q $ | Rename the current session |
Ctrl+q s | Switch session |
Window Management
| Command/Shortcut | Description |
|---|---|
Ctrl+q c | Create a new window |
Ctrl+q & | Close the current window |
Ctrl+q n | Switch to the next window |
Ctrl+q p | Switch to previous window |
Ctrl+q <number> | Switch to window by number |
Ctrl+q , | Rename current window |
Pane management
| Command/Shortcut | Description |
|---|---|
Ctrl+q % | Split current pane vertically |
Ctrl+q " | Split current pane horizontally |
Ctrl+q <arrow> | Move focus between panes |
Ctrl+q x | Close current pane |
Ctrl+q z | Maximize/Restore current pane |
Ctrl+q Space | Switch pane layout |
history
In tmux, the “history mode” is the copy-mode, once you enter it, you can:
- Scroll through history with arrow keys (or C-p C-n)
- Scroll with mouse wheel
Press:
Ctrl + q [
