Quick survival guide to tmux

🤔 Wait a minute, what the hell is tmux?

  • You just connected to a Linux box through SSH, but hey, I want to run more than one command at a time! One shell is just not enough! Use tmux and you can have any number of terminals you want!
  • You connected to a Linux box through SSH, but hey, I want to run this command forever! Use tmux and you can run any command you want, detach from the terminal and it will keep running. For-eh-vah!
  • You love the good and old terminal, but you want more power to switch between shells really freaking fast. Use tmux!
  • You love both the terminal and Vim. Use tmux!

🤘 Cool! How I install it?

sudo apt install tmux
brew install 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?

  • Tmux runs sessions where we can attach clients to
  • Each session can have many windows (listed on the bottom)
  • Each window can have many panes (the split panes you'll see)
  • Each new pane is a new bash prompt/terminal
tmux
tmux a
tmux ls
tmux a -t 0

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

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?

C-b : setw synchronize-panes on
C-b : setw synchronize-panes off
C-b D
C-b <space>
C-b : move-window -r

--

--

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