Felipe Martín

Be incomprehensible. If they can't understand, they can't disagree.

Tmux basics

Published on 2015-08-04 with no comments.

Discovered it not a long time ago (and now replaced with the experimental version of iterm2 because of goodies), tmux deserves a lot of attention because it have lots of potential.

TMUX stands for 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. And do a lot more. Yeah, they sell themselves well.

For the novices, it lets you have panels (split terminals) and windows just with some keybinds, detaching from them (so they keep running) and with the possibility of storing configurations for certain tasks, in which you need to open a running server and editor and some watcher at the same time, just with a command.

For example, if you are like in the top screenshot, pressing CTRL+b%CTRL+b" changes the layout to this:

And those numbers with a tilde at the bottom? The open windows. You can open more pressing CTRL+bc, like this:

This are the two basic things you will use everyday. Of course, there are more stuff you can do, but for the basics I will list the more frequent keybinds here to start using it right now.

Meta keyCTRL+b
Split pane horizontalMeta+"
Split pane verticalMeta+%
Swap paneMeta+o
Kill paneMeta+x
Toggle focus on current paneMeta+z
Show pane numbersMeta+q
Press a the number of the pane you want to focus when shown.
Break pane into windowMeta++
Restore window to paneMeta+-
Change pane layoutMeta+spacebar
Create new windowMeta+c
Switch to window #xMeta+<number>
Kill windowMeta+&
Next windowMeta+n
Previous windowMeta+p
List windowsMeta+w
Rename windowMeta+,
Find windowMeta+f