DevDungeon
- Labs
Knowledge
Social
DevDungeon
Knowledge
Social
This is an old revision of the document!
Tmux is a terminal multiplexer that lets you have multiple virtual terminals and also split windows and have multiple panes and tabs. Another nice feature is if you are connecting over SSH and using Tmux, Tmux can keep your session going even if you disconnect and re-connect later.
In Debian, you can simple use the system package manager to install:
sudo apt install tmux tmux -V # Check version
To build from source, download sources from the Tmux GitHub Releases. Building is pretty simple, it has few dependencies and compiles quickly.
# Install buidl dependencies sudo apt install libevent-dev ncurses-dev build-essential bison pkg-config wget https://github.com/tmux/tmux/releases/download/3.1c/tmux-3.1c.tar.gz tar -zxf tmux-3.1c.tar.gz cd tmux-3.1c/ # Identify the options you want ./configure --help | less ./configure make ./tmux -V sudo make install # Optional
To initialize a tmux session, simply invoke tmux
.
tmux
To get help information and a list of commands, use:
man tmux tmux --help tmux list-keys tmux list-commands # Within tmux press ''CTRL-b ?''
When you start tmux, you are creating a “session”. You can have multiple sessions and they are identified by a number or a name.
# List active sessions tmux ls # Connect to last active session tmux attach # Connect to a session by its numeric ID tmux attach -t 0 If you want to create a named session you can do that like this: # Create a new named session tmux new -s "mysession" # Connect to a session by name tmux attach -t "mysession"
Once you are in a session and you want to disconnect,
# Use the shell command tmux detach # Or use the keybinds CTRL-b d
tmux new-window tmux list-windows tmux select-window -t 1 tmux rename-window # Renames current window
tmux split-window tmux split-window -h
tmux swap-pane -\[UDLR\]
Create a new window - c
List window - w
Select a window - (the number of the window)
Rename windows - ,
Kill window - &
Next window - n
Previous window - p
Last window - l
Split window horizontally in two panes - “
Split window vertically in to two panes - %
Set even split horizontally - ALT-1 Set even split vertically - ALT-2
Switch active pane - up/down/left/right arrow Next pane - o Previous pane - ; Kill pane - x Break out pane in to window - ! Resize pane 1 unit - CTRL- plus left/right/up/down arrow Resize pane 5 units - ALT- plus left/right/up/down arrow Swap pane up/down - { or } Rotate pane up/down - CTRL-o or ALT-o
Every command is assumed to begin with the chord, which by default is CTRL-b
. Press CTRL-b
and then release before pressing the next action key.
CTRL-b [
SPACE