DESCRIPTION
tmux is an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window.
SYNOPSIS
### tmux [-28lCquvV] [-c shell-command] [-f file] [-L socket-name] [-S socket-path] [command [flags]]
# Simple way
tmux [command [flags]]
command [flags]
This specifies one of a set of commands used to control tmux, as described in the following sections.
If no commands are specified, the new-session command is assumed.
CLIENTS AND SESSIONS
The tmux server manages clients, sessions, windows and panes.
In tmux, a session is displayed on screen by a client and all sessions are managed by a single server.
Clients are attached to sessions to interact with them, either when they are created with the new-session command, or later with the attach-session command.
Each session has one or more windows linked into it. Windows may be linked to multiple sessions and are made up of one or more panes, each of which contains a pseudo terminal.
tmux shortcuts & cheatsheet
start new:
tmux
start new with session name:
# tmux new-session -s session-name
# alias: new-session = new
tmux new -s my-session
list sessions:
# tmux list-sessions
# alias: list-session = ls
tmux ls
attach to named:
# tmux attach-session -t target-session
# alias: attach-session = attach/at/a
tmux attach -t my-session
kill session:
tmux kill-session -t myname
Kill all the tmux sessions:
tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill
List all shortcuts
to see all the shortcuts keys in tmux simply use the bind-key ?
in my case that would be CTRL-B ?
Sessions
d detach from tmux, leaving everything running in the background
s list sessions
$ name session
:new-session new session
:<CR> new session
Windows
w list windows
c create window
, name window
n next window
p previous window
f find window
& kill window
Panes (splits)
% vertical split
" horizontal split
x kill pane
q show pane numbers
o swap panes
ctrl-b, <arrow key> switch to the pane in whichever direction you press