tmux kill-session
# kill all sessions
tmux ls
# list all sessions
To enable Iterm2 to access the clipboard
- General -> Selection -> Applications in terminal may access clipboard
The common commands
11. Create a new session: tmux new-session or tmux new -s <session-name>
22. Detach from a session: Ctrl + b followed by d
33. Attach to a session: tmux attach-session or tmux attach -t <session-name>
44. Switch between sessions: Ctrl + b followed by (
55. Rename a session: Ctrl + b followed by $
66. Create a new window: Ctrl + b followed by c
77. Switch between windows: Ctrl + b followed by a number key (e.g., 0 for window 0, 1 for window 1, and so on)
88. Close the current window: Ctrl + b followed by &
99. Split the current pane vertically: Ctrl + b followed by %
1010. Split the current pane horizontally: Ctrl + b followed by "
1111. Switch between panes: Ctrl + b followed by o
1212. Close the current pane: Ctrl + b followed by x
1313. Resize panes: Ctrl + b followed by Ctrl + arrow key (e.g., Ctrl + b followed by Ctrl + Left arrow key to decrease width)
1414. Scroll through pane history: Ctrl + b followed by [ (then use arrow keys or Page Up/Down to navigate)
1515. Rename a window: Ctrl + b followed by ,
1616. Show all sessions: Ctrl + b followed by s
1717. Show tmux command prompt: Ctrl + b followed by
1818. tmux source-file ~/.tmux.conf
The shortcut
1Ctrl-b ? # Show the list of key bindings (i.e., help) Create a new window
2Ctrl-b c # Create the new windows
3Ctrl-b n # Go to next window
4Ctrl-b p # Go to previous window
5Ctrl-b 0 # Go to window 0. Numbers 1-9 are similar.
6Ctrl-b w # Show window list. The status bar lists windows, too. Rename the current window
7Ctrl-b , # Rename the current window
The .tmux.conf
to settings
1set-option -g prefix C-a # to set the prefix key to Screen command same
2set-option -g prefix2 C-b
3bind-key C-a send-prefix
4set -g mouse on
5set -g base-index 1
6setw -g pane-base-index 1
7# Copy to Clipboard
8bind C-c run "tmux save-buffer - | xclip -i -sel clip"
9bind C-v run "tmux set-buffer $(xclip -o -sel clip); tmux paste-buffer"