Tmux Tutorial and Command List Cheat Sheet

In this tmux tutorial you will learn basic tmux usage and list of of essential commands.

tmux is an open-source terminal multiplexer (Terminal MUltipleXer) for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window. It is useful for running more than one command-line program at the same time. It can also be used to detach processes from their controlling terminals, allowing remote sessions to remain active without being visible.

tmux is more user-friendly than the Screen and has a status bar.

Installing tmux

To install tmux use YUM or APT package manager

Installing tmux on Ubuntu or Debian

$ sudo apt install tmux

Installing tmux on CentOS, RedHat, Fedora

$ sudo apt-get update
$ sudo yum install tmux

Tmux Create Session

Creating session

tmux session can started by simply typing tmux in console:

$ tmux

or by creating named session.

Creating named session

$ tmux new -s session_name

Detach from tmux Session

To detach from the tmux session and return to normal shell use shortcut Ctrl+b following by d or just type: tmux detach from the console.

$ Ctrl-b d

List tmux Sessions

For attaching tmux session we need know the session name, name we can get from sessions list.

To get list all tmux sessions type:

$ tmux ls

Example output:

Sessions name you can see in first column (highlighted) – session1, session2_test, session3_test…

Tmux Attach to Session

To attach session type:

$ tmux attach -t session_name

Or you can attach last detached session by typing:

$ tmux a

Tmux Windows

In tmux session we can use tabs, or “Windows”. Each window has name. To stay organized we can assign name, rename or kill.

Tmux New Window

To create new window in tmux session:

$ Ctrl-b c

Switch Between Windows

Go to next window Ctrl-b n, go to previous window Ctrl-b p.

Tmux List Windows

To show list of windows and navigate use command:

$ Ctrl-b w

Tmux Panes (splits)

Ctrl-b % vertical split
Ctrl-b ” horizontal split
Ctrl-b o swap panes
Ctrl-b q show pane numbers
Ctrl-b x kill pane

If you need learn more about tmux usage and configuration visit the tmux manual pages. If you have installed man utility in your system just type: man tmux or info tmux in console.

Tmux Cheat Sheet

Session Management

tmux
tmux new -s session_name – Create named session
tmux list-sessions – List Sessions
Ctrl+b d – Detach
tmux a – Attach

Tmux Windows (tabs)

Ctrl-b c – Create new window
Ctrl-b w – List windows
Ctrl-b n – Next window
Ctrl-b p – Previous window
Ctrl-b , – name window
Ctrl-b & -Kill window

Panes

Ctrl-b % – vertical split
Ctrl-b ” – horizontal split
Ctrl-b o – swap panes
Ctrl-b q – show pane numbers
Ctrl-b x – kill pane

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee
Summary
Tmux Tutorial and Command List Cheat Sheet
Article Name
Tmux Tutorial and Command List Cheat Sheet
Description
In this tmux tutorial you will learn basic tmux usage and list of of essential commands. tmux is an open-source terminal multiplexer
Author
Publisher Name
ARSTECH
Publisher Logo

arstech

Leave a Reply

Your email address will not be published. Required fields are marked *