tmux cheatsheet

Created:

Updated:

Introduction

Terminal MUltipleXer (tmux) allows you to switch between several terminals in one, detach and reattach. Using tmux is useful when you want to keep programs running on the background, like screen. tmux allows to split the screen into panes and you can use multiple windows.

You can customize shortcuts by adding a .tmux.conf in your home directory, in this cheatsheet we don’t use any customization and it will work with default configuration.

tmux Commands cheatsheat

For triggering actions in tmux you need to use the bind-key, by default is ctrl+b followed by a key.

command action
tmux new -s tutorialstech Start new session named tutorialstech
tmux ls list available sessions
tmux a attach
tmux a -t tutorialstech attach to session tutorialstech
tmux kill-session -t tutorialstech kill session with name tutorialstech

ctrl+b actions

When tmux is running press ctrl+b and the key:

key action
c new window
" vertical split
% horizontal split
switch pane
n next window
x kill pane
d detach

| & | kill window | | | change pane layout |

| , | name window | | w | list windows | | f | find window | | t | show time in terminal |

Other usefull actions

move window 2 into a new pane in the current window

:joinp -s :2<CR>  

move the current pane into a new pane in window 1

:joinp -t :1<CR>  
````

Kill all tmux sessions:

tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill ```