Skip to main content
  1. Knowledge Base/
  2. Applications/

Tmux

Find my tmux config here and here all of my dotfiles

Why tmux
#

  1. Multiple shell windows and panes from a single connection
  2. Session functionality that survives disconnects
  3. Session sharing
  4. Plugins extend functionality
  5. Keyboard driven
  6. Highly customizable

Alternative: screen which comes preinstalled on most distributions

Basic concepts
#

  1. Windows are like tabs in your internet browser
  2. Panes are splits of windows each containing an individual shell
  3. Sessions represent a state of different windows and panes

Starting tmux
#

tmux # start fresh session
tmux new-session -s NAME # create new session with NAME
tmux a # attach to session
tmux a -t NAME # attach to named session
tmux ls # list running sessions
tmux kill-session -t NAME # kill session NAME

Commands
#

Commands are composed of the tmux prefix (default CTRL+b) and the actual command. Be aware that my config may vary!

commandaction
prefix ccreate new window
prefix nswitch to window number n
prefix &kill current window
prefix wlist windows
prefix ,rename window
prefix .move window to given number
prefix %split window vertically
prefix "split window horizontally
prefix xkill current pane
prefix ddetach tmux (back to normal shell)
prefix ?list shortcuts
prefix tshow big clock

Command prompt
#

With :you can start a command prompt similar to Vim’s ex mode. Tab-autocompletion is available

Advanced
#

Respawn tmux pane
#

In tmux command mode

:respawn-pane -k

Set tmux as login shell
#

In your .bashrc or zshrc

if command -v tmux>/dev/null; then
  [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
fi

Attach to a tmux session within tmux
#

list sessions

: list-sessions

Attach to session identified by its number

: attach-session -t NUMBER

There are no articles to list here yet.