Skip to content

Instantly share code, notes, and snippets.

@8bitDesigner
Last active September 24, 2018 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 8bitDesigner/b23afca346cad6131909 to your computer and use it in GitHub Desktop.
Save 8bitDesigner/b23afca346cad6131909 to your computer and use it in GitHub Desktop.
tmux Cheat Sheet

Overview

What 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. And do a lot more. See the manual.

https://tmux.github.io/

Awesome resources

A damned good cheatsheet (remember that the default prefix is 'ctrl-b')
https://tmuxcheatsheet.com/

A Crash Course from Thoughtbot
https://robots.thoughtbot.com/a-tmux-crash-course

Cheat sheet

By default [prefix] means pressing and releasing the ctrl and b keys together. The tmux config attached to this gist rebinds [prefix] to ctrl-a, which is a way easier to type.

Getting started

  • tmux creates new tmux session
  • tmux attach -t [target session] reattaches to an existing session

Windows

  • tmux create-window or [prefix]-c creates a new window, like a tab in Chrome
  • tmux previous-window, tmux next-window or [prefix]-(, [prefix]-) move between-windows
  • [prefix]-(number) selects the window with that ID

Panes

  • tmux split-window or [prefix]-" split a window vertically
  • tmux split-window -v or [prefix]-% split a window horizontally
  • tmux select-pane -[UDLR] or [prefix]-(arrow key) select the next pane in that direction
# Below is a minimal tmux.conf file
# Copy and paste this file's contents to a file called ".tmux.conf"
# to and restart your tmux server for these to take effect
# Once you get up and running you may want to check out my config here :
# https://github.com/8bitDesigner/Dotfiles/blob/master/.tmux.conf
# Set prefux
unbind C-b
set-option -g prefix C-a
# Use mouse to select panes/windows/etc.
set-option -g mouse on
# Remove key delay on escape, because vim
set-option -sg escape-time 0
#! /bin/bash
# A simple bash script to configure a terminal session
# for developing our Accounts app.
tmux split-window -h
tmux split-window -v
tmux send-keys -t top 'tail -f log/development.log' C-m
tmux send-keys -t bottom 'bundle exec sidekiq' C-m
tmux send-keys -t right 'open "http://accounts.fullscreen.dev"' C-m
tmux send-keys -t right 'vim .' C-m
tmux select-pane -t right
@denniseichardt-addapptr

2-.tmux.conf, line 8:

Typo, prefix instead of prefux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment