Skip to main content

Cheat Sheet :: Tmux

Working with Sessions

New Session

  • Start a New Session

    $> tmux new-session
  • Or you can type

    $> tmux
  • Or you can use the shorthand

    $> tmux new
  • If you're already inside the tmux

    : new
  • Start a New Session with the name mysession

    $> tmux new -s mysession : new -s mysession

Kill/Delete Sessions

  • Kill/Delete mysession

    $> tmux kill-session -t mysession
  • Or you can use the shorthand

    $> tmux kill-ses -t mysession
  • Kill/Delete all sessions but mysession

    $> tmux kill-session -a -t mysession
  • Kill/Delete all sessions but the current session

    $> tmux kill-session -a

Rename session

  • If you're already inside the tmux

    Ctrl + b + $

Move Between Sessions

  • Move to Previous Session // If you're already inside the tmux

    Ctrl + b + (
  • Move to Next Session // If you're already inside the tmux

    Ctrl + b + )

Attach to an Existing Session

Attach to the Last Session

$> tmux attach-session
  • Or

    $> tmux attach
  • Or

    $> tmux at
  • Or you can use the shorthand

    $> tmux a

Attach to an Existing Session with the Name mysession

$> tmux attach-session -t mysession
  • Or

    $> tmux attach -t mysession
  • Or

    $> tmux at -t mysession
  • Or you can use the shorthand

    $> tmux a -t mysession

Detach from Session

  • If you're already inside the tmux

    Ctrl + b + d

Show ALL sessions

  • Listing ALL sessions

    $> tmux list-sessions
  • Or you can use the shorthand

    $> tmux ls
  • If you're already inside the tmux

    Ctrl + b + s

Working with tmux Window

Start a new Window

  • Start a new session with the name mysession and window name mywindow

    $> tmux new -s mysession -n mywindow
  • Create a new Window // If you're already inside the tmux

    Ctrl + b + c

Rename a Window

  • Rename current window

    Ctrl + b + ,
  • Close the current window

    Ctrl + b + &

Moving Between Windows

  • Previous window

    Ctrl + b + p
  • Next window

    Ctrl + b + n
  • Select window by number

    Ctrl + b + 0...9

Reorder a Window

  • Swap window number 2 and 1

    : swap-window -s 2 -t 1

Working with Panes

Toggle Panes

  • Toggle last active pane

    Ctrl + b + ;

Split the Pane

  • Split pane vertically

    Ctrl + b + %
  • Split pane horizontally

    Ctrl + b + "

Moving Between Panes

  • Move the current pane to the left

    Ctrl + b + {
  • Move the current pane t the right

    Ctrl + b + }

Switching Between Panes

  • Switch to pane to the direction

    Ctrl + b + ⬆ Ctrl + b + ⬇ Ctrl + b + ⬅ Ctrl + b + ⮕

Toggle synchronize-panes

  • Send the same command to all panes

    : setw synchronize-panes

Toggle Between Panes

  • Toggle between pane layouts

    Ctrl + b + <SpaceBar>
  • Switch to next pane

    Ctrl + b + o
  • Show pane numbers (Type the number to go to that pane)

    Ctrl + b + q

Toggle the Pane Zoom

Ctrl + b + z

Convert a Pane into a Window

Ctrl + b + !

Resize the Pane

  • Resize the current pane height

    Ctrl + b + ⬆ Ctrl + b + ⬇
  • Resize the current pane width

    Ctrl + b + ⬅ Ctrl + b + ⮕

Close the Pane

  • Close the Current Pane

    Ctrl + b + x

Enter in Copy Mode (Buffer)

  • Enter in Copy Mode

    Ctrl + b + [
  • Enter in Copy Mode and Scroll One Page Up

    Ctrl + b + PgUp
  • Quit Mode

    q
  • Go to Top Line

    g
  • Go to Bottom Line

    G

Scroll using the Keyboard Cursor (Arrows)

  • Scroll Up

    Keyboard Up Cursor // ⬆
  • Scroll Down

    Keyboard Down Cursor // ⬇
  • Scroll Left

    Keyboard Left Cursor // ⬅
  • Scroll Right

    Keyboard Right Cursor // ⮕

Scroll using the vim keys

FIRST: Remember to Set the vim keys in Buffer Mode. Go to Set the runtime tmux Options section to learn more.

  • Move Cursor to the Left

    h
  • Move Cursor Down

    j
  • Move Cursor to the Up

    k
  • Move Cursor to the Right

    l
  • Move Cursor Forward One Word At a Time

    w
  • Move Cursor Backward One Word At a Time

    b
  • Search forward

    /
  • Search backward

    ?
  • Go to the Next Keyword Occurrence

    n
  • Go to the Previous Keyword Occurrence

    N

Working with Buffers

  • Start a Selection

    <SpaceBar>
  • Clear the Selection

    <Esc>
  • Copy selection

    <Enter>
  • Paste the Contents of Buffer_0

    Ctrl + b + ]
  • Display the Buffer_0 Contents

    : show-buffer
  • Copy the Entire Visible Contents of Pane to a Buffer

    : capture-pane
  • Show All Buffers

    : list-buffers
  • Show All Buffers and Paste Selected

    : choose-buffer
  • Save the Buffer Contents to the file buf.txt

    : save-buffer buf.txt
  • Delete the Buffer_1

    : delete-buffer -b 1
  • Enter the Command Mode

    Ctrl + b + :

Set the runtime tmux Options

  • Set OPTION for All Sessions

    : set -g OPTION
  • Set OPTION for All Windows

    : setw -g OPTION
  • Set to use vim keys in Buffer Mode

    : setw -g mode-keys vi
  • Set the vim Buffer Size in Runtime (history)

    set-option -g history-limit 50000
  • Start a New Session with a Defined Buffer Size (history)

    tmux set-option -g history-limit 50000; new-session

Help

  • Show Every Session, Window, Pane, etc...

    $> tmux info
  • Show Shortcuts

    Ctrl + b + ?


Comments

Popular posts from this blog

Installing PIP in OpenBSD 5.6

pip included with Python Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default [1], so you may have pip already. Install pip To install pip, securely download get-pip.py: #curl --remote-name https://bootstrap.pypa.io/get-pip.py Then run the following (which may require administrator access): #python get-pip.py If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you. To upgrade an existing setuptools (or distribute), run pip install -U setuptools.

Instalando Packet Tracer 6.3 no Fedora 23

Vamos começar... 1. Baixe o arquivo desse link:     http://www.deltaeridani.com/openssl-lib-compat-1.0.0i-1.fc20.i686.rpm 2. Baixe o Packet Tracer 6.3 do site netacad.com 3. Instale as seguintes dependencies:     dnf install libICE.i686 libpng libSM.i686 libX11.i686 libXext.i686 libXi.i686 libXrandr.i686 fontconfig.i686 libgcc.i686 glib.i686 compat-libstdc++-33.i686 libstdc++.i686 glib2.i686 libgthread-2.0.so.0 libglib-2.0.so.0 4. Instale usando o dnf o pacote que voce baixou no item 1:     dnf install openssl-lib-compat-1.0.0i-1.fc20.i686.rpm 5. Instalando o Packet Tracer 6.3:     tar xfvz PacketTracer63_linux.tar.gz     cd PacketTracer63/     sudo su     ./install     exit 6. Criando o atalho na área de trabalho ( Usando seu usuário padrão )     cp /opt/pt/art/app_student.png /usr/share/icons/     emacs /home/usua...

Using GnuPG for SSH authentication

“Using GnuPG for SSH authentication” may refer to two distinct things: making the GnuPG agent (which is normally used to cache the passphrase of your OpenPGP key) to also act as a SSH agent, to cache the passphrase of your SSH key; using a key pair of your OpenPGP keyring as a SSH key pair. In this note, I will explain how to do this in GnuPG 2.1 (“modern”).