Quick survival guide to tmux

Yep, this is the one. You can stop searching now. Just bookmark this page and come back here when you wanna remember some basic tmux keystroke or to setup a basic tmux config in a fresh Linux/Unix box 😉

🤔 Wait a minute, what the hell is tmux?

Tmux is a terminal multiplexer. Wait, what? Why I need that?

🤘 Cool! How I install it?

At Ubuntu:

sudo apt install tmux

At Mac:

brew install tmux

Download this minimal config file I created at your home sweet home. It has the minimal required to improve your UX on tmux:

wget https://gist.githubusercontent.com/automata/2a3e8a276b2fd05ae13d086422dc4140/raw/b09631ed5255d32a93cd2e1f396ef52631409fcd/tmux.conf -O ~/.tmux.conf

🤓 OK it was easy… how can I use it now?

First, some basic concepts you'll become familiar with:

To create a new session:

tmux

Now you can type C-b dand you'll dettach from the session. It's still running there, but you can exit you're SSH session now and attach again later… and all your beloved terminals will still be running 😍

To attach to a session you just created:

tmux a

To list existing sessions:

tmux ls

To attach to a specific session (see the first column from previous command, that's the id you need to use here. I'm using session zero):

tmux a -t 0

🤸🏻‍♀ That's super cool! But how can I move around?!

All commands start with C-b (C is the command key on Mac and thectrl key on Linux). So, basically always type the C-b prefix before almost every keystroke.

And here are the commands I use all the time and they should be enough for you to use tmux for weeks without having to worry much about it:

C-b c                     Create a new window
C-b | Split window vertically
C-b - Split window horizontally
C-b <arrow keys> Move between panes
C-b <h,j,k,l> Move between panes Vim-style
C-b <number> Go to window number n (listed at bottom)
C-b [ Enter in "scroll mode".
- Use arrows and page-down/up to move
- Type Enter to exit the mode.
C-b d Detach from session (to get back: tmux a)

😎 That's it?

Yep… and nope 😉 Tmux is an awesome piece of software with many, many more possibilities. Check its official Git repos for more and follow me on Twitter, I'll keep sharing tools and tricks I use daily as a Machine Learning engineer and CTO that can probably help you too! 👋

Coder, applied physicist and artist. I create algorithms that create. CTO at Extend AI. Half of 2aliens.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store