kb:localhost:software:tmux:start
tmux
Changelog
- 2026-03-18: Init
Quick start
sudo apt install tmux # on Ubuntu
Three different ways to trigger a tmux command:
tmux <COMMAND># via tmux program(C-b) :<COMMAND># tmux command window(C-b <HOTKEY>)# tmux command hotkey/keybinding
Working with sessions (equivalent to a single desktop environment):
- Start a new session:
tmux(new command) - See all keybindings:
C-b ? - Detach session:
C-b d(detach) - Attach session:
tmux a -t [SESSION_NAME](attach) - Rename session:
C-b $ - List sessions:
tmux ls(list-sessions) - Kill session:
tmux kill-session/tmux kill-server
Working with windows (equivalent to individual program windows in DE):
- Create new window:
C-b c(neww) - Change windows:
C-b 0/C-b 1/ ... /C-b l(last window) - Kill window:
C-b &
Working with panes:
- Split window into panes:
C-b %orC-b "(split-window) - Change panes:
C-b Up/C-b Down/ ... - Move panes:
C-b {/C-b } - Tile panes:
C-b M-5(e.g. for even tiling) - Kill pane:
C-b x - Adjust pane layouts:
C-b [space]
Enable mouse support with :set -g mouse on. This changes some behaviours with regard to copy and pasting: highlight can still be done by holding Shift. Some things one can do:
- Left-click pane to set as active
- Left-click drag pane borders to adjust
- Right-click pane for context menu
- Left-click window title to set as active
- Left-click drag pane text to copy (
C-b ]to paste)
Configure tmux server with config file at ~/.tmux.conf.
Copying
Configuration
- ~/.tmux.conf
#~/.tmux.conf # Quick reload for tmux configuration edits bind r source-file ~/.tmux.conf \; display "Reloaded!" # Remap prefix from C-b to C-a (minicom convention) unbind C-a set -g prefix C-a bind C-a send-prefix # Add mouse support # requires wl-clipboard set -g mouse on setw -g mode-keys vi bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy" # Increase history set-option -g history-limit 5000 # Change window and pane numbering (and cleanup) set -g base-index 1 setw -g pane-base-index 1 set -g renumber-windows on # Use '-' and '|' for vertical and horizontal splits bind-key "|" split-window -h -c "#{pane_current_path}" bind-key "\\" split-window -fh -c "#{pane_current_path}" bind-key "-" split-window -v -c "#{pane_current_path}" bind-key "_" split-window -fv -c "#{pane_current_path}" # Preserve path on window creation bind c new-window -c "#{pane_current_path}" # Fast select windows bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 bind -n M-3 select-window -t 3 bind -n M-4 select-window -t 4 bind -n M-5 select-window -t 5 bind -n M-6 select-window -t 6 bind -n M-7 select-window -t 7 bind -n M-8 select-window -t 8 bind -n M-9 select-window -t 9 # Switch panes with Alt-arrows bind -n M-Left select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -D # Compatibility for systems without 'tmux-256color' set -g default-terminal "screen-256color" # My favorite CLI shell set -g default-shell /usr/bin/fish # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-strategy-vim 'session' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-save-interval '5' set -g @continuum-boot 'on' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'
Systemd service:
#/etc/systemd/system/tmux@.service [Unit] Description=tmux session for user %I [Service] Type=forking User=%I ExecStart=/usr/local/bin/tmux new-session -s %I -d ExecStop=/usr/local/bin/tmux kill-session -t %I [Install] WantedBy=multi-user.target
kb/localhost/software/tmux/start.txt · Last modified: 8 days ago ( 8 October 2026) by Justin
