tmux Tutorial

tmux or terminal multiplexer; it allows several terminals to be created, accessed, and controlled from a single screen. tmux maybe detached and attached later and keep in progress tasks without interrupting it. It is one of my favorite tools.

I run some tasks unattended and close the terminal. And i want to go back to my last session when i come back and open my terminal. Usually terminal app will close your session when you close the terminal window. Then tmux saved my live. My last session still there and i can continue my last tasks.

Install tmux

I am using Ubuntu, so this tutorial will cover for this OS.

sudo apt update && sudo apt install tmux -y

tmux cheatsheet

Commands Usage
# Moving between windows
List tmux sessions tmux ls (or tmux list-sessions)
Create new session with custom session-name tmux new -s session-name
Detach from session Ctrl-b d
Attach to a session tmux attach -t [session name]
Kill session-name tmux kill-session -t session-name
Create new window Ctrl-b c
Detach current client Ctrl-b d
Move to previously selected window Ctrl-b l
Move to the next window Ctrl-b n
Move to the previous window Ctrl-b p
Kill the current window Ctrl-b &
Rename the current window Ctrl-b ,
Show pane numbers (used to switch between panes) Ctrl-b q
Switch to the next pane Ctrl-b o
# Moving between windows
Move to the next window Ctrl-b n
Move to the previous window Ctrl-b p
Move to the previously selected window Ctrl-b l
List all windows / window numbers Ctrl-b w
Move to the specified window number, the default bindings are from 0 — 9 Ctrl-b
# Tiling commands
Split the window vertically Ctrl-b %
Split window horizontally CTRL-b "
Goto next pane Ctrl-b o
Show pane numbers, when the numbers show up type the key to go to that pane Ctrl-b q
Move the current pane left Ctrl-b {
Move the current pane right Ctrl-b }
# Make a pane its own window Ctrl-b : "break-pane"

Leave a Reply

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