Starting with tmux

What is tmux? Link

  tmux is a “terminal multiplexer”, allowing you to have multiple terminal log-ins controlled within one single terminal window. With tmux you don’t have to open additional windows or additional tabs to access something else with the terminal while keeping your existing session going.

Benefits

  • Persistence (You can reconnect after you disconnect)
  • Sharing (multiple people can use the same session)
  • Multiple windows and panes

General Commands

tmux - Start a tmux session, will display the user, time, program, etc

<C-b> - The “Leader”, will be used before many of the tmux commands now that the session has started

Windows

<Leader> c - Create a new window (displayed in the bottom left-hand corner, and looks something like [0] 0:base- 1:bash*) - * Indicates which window is active

<Leader> n - Switch to the next tmux window in order

<Leader> # - Switch to the specified tmux window

Panes

<Leader> % - Create a vertical split in your window

<Leader> " - Create a horizontal split in your window

<Leader> arrow - Switch which window pane is active

Command Mode Commands

<Leader> : - Enter command mode

  • rename-window new-name - To rename the active window

  • rename-session new-name - To rename the active session

  • kill-session - To close the active tmux session

Detaching and Reattaching to a tmux Session

<Leader> d - Detach from the session

tmux ls - List the available (done in the regular terminal window)

tmux attach - Reattach to the previous session

<Leader> s - List the active tmux sessions - From here you can navigate to your desired session and switch to your selection