1 minute read

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

1. Cheatsheet

/assets/images/TryHackMe/Tmux/Untitled.png

Initial Sequence to send commands

ctrl + b

Creating a new session

For session without a custom name

$ tmux

Session with custom name

$ tmux new -t <session_name>

Detach from the current session

ctrl + b + d

List all sessions #not_in_cheatsheet

$ tmux ls

Attach a tmux session

By name

$ tmux a -t <session_name>

Creating a new window in a session

ctrl + b + c 

Enter copy mode

Used when copying of results is needed. Used when screen is full and needs to scroll above. Similar to less

ctrl + b + [

Start Selection

In order to start the selection of contents press

ctrl + space

and use arrow keys to go to the end of text you want to copy.

Copy Selection

ctrl + w or alt + w

Paste Selection

ctrl + b + ]

Go to top

alt + shift + ,

Exit copy mode

q

Window operations

Panes are sections of windows that has been split into different screens.

Split Vertically

ctrl + b + %

Split Horizontally

ctrl + b + "

Moving between panes

ctrl + b + <arrow_keys>

Convert pane to window

Rename window

ctrl + b + ,

List windows

ctrl + b + w

Kill window

ctrl + b + &

Search window

ctrl + b + f

Killing pane

If a pane becomes unresponsive

ctrl +b + x

Close a window

$ exit

Default first session name is 0 when not specified.

/assets/images/TryHackMe/Tmux/Untitled%201.png

ctrl + b + !