Skip to content

Tmux

Set up tmux on linux

Terminal window
sudo apt-get install -y tmux tmuxinator

Basic

  • Create a named session called “basic”
Terminal window
tmux new -s basic
  • Exit the session:
Terminal window
exit

CheatSheet

  • Session:

    ShortcutDescriptionUsage
    Ctrl + bPrefix
    tmux new -s basic_sessionCreate a new tmux session
    Prefix + dDetach from a tmux sessionEnter 1 session, do some work (like htop), detach from this session
    tmux lsList sessions
    tmux attach -t basic_sessionAttach the session to current terminal
  • Windows:

    ShortcutDescription
    Ctrl + bPrefix
    tmux new -s windows -n shellCreate a tmux session called “windows”, the initial window is called “shell”
    Prefix + cCreate a window in a current ession, automatically brought into focus
    Prefix + ,Rename a window name
    Prefix + nMove to next window
    Prefix + pMove to previous window
    Prefix + 0 (number)Move to the first window
    Prefix + wDisplay a visual menu of all windows
    Prefix + fFind window that contains a string of text
  • Panes:

    CommandDescription
    Ctr + bPrefix
    tmux new -s panes_demoCreate a session to demo panes
    Prefix + %Split the window in half vertically
    Prefix + “Split the window horizontally
    Prefix + h,j,k,l (o)Move around the panes, cycle through the panes
CommandDescription
Prefix + [Into copy mode
Prefix + ] / Prefix + P Ctr + VPaste
EnterGet out of copy mode
Ctrl - bMove up 1 page
Ctrl - fMove down 1 page
[Copy mode] ?Search backward
[Copy mode ?] njump to next occurrence
[Copy mode ?] Njump to the previous
[Copy mode] /Search downward
[Copy mode /] njump to next occurrence
[Copy mode /] Njump to the previous
Prefix + =View all copy buffer and choose 1

Tmuxinator

export EDITOR=vim