Skip to content

Instantly share code, notes, and snippets.

@diginc
Last active January 3, 2016 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diginc/8531848 to your computer and use it in GitHub Desktop.
Save diginc/8531848 to your computer and use it in GitHub Desktop.
Tmux Basics , Also see: The config https://gist.github.com/diginc/8525360 and the session script https://gist.github.com/diginc/b329c4a84a274c906aa6

Intro

'2 CLI windows? Why not tmux'

Learn the basics of my tmux config (stock is not wonderful)

From : https://en.wikipedia.org/wiki/Tmux " tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session. It is useful for dealing with multiple programs from a command line interface, and for separating programs from the Unix shell that started the program.[1] It provides much of the same functionality as GNU Screen, but is distributed under a BSD license."

Terms:

  • Tabs = numbered windows within a single session
  • Sessions = command line tmux, aided by scripts to auto attach/dettach to named sessions rather than 'default' or cryptic named ones

Multiple tabs = related things Multiple sessions = complete segregation

Adam Todo: setup saved session/tab startups

The Basics

Install program + session create/resume bash alias + config

Google tmux install + your OS

Session scripts

https://gist.github.com/diginc/b329c4a84a274c906aa6 add this to your aliases and start/resume sessions with the tm function, optionally passing it a session name.

Configuring commands

My tmux command configuration is based off a tmux e-book I purchased, stock is not very fluid or intuitive. Changes pre-fix to match screen's and navigation to match VIM's amont many other things.

My Config

Usage

ctrl+a = Tmux command prefix

tab control prefix + c = create new tab (current sesion) prefix + , = rename tab ( default name is current command ) prefix + x = exit/kill tab ( or just 'exit' your shell normally )

Navigation based on vim vim L = h vim Down = j (not needed for tabs) vim Up = k (not needed for tabs) vim R = l

prefix + ctrl+l Right prefix + ctrl+h Left prefix + # Goto # of tab prefix + a Last used window

Tab winodow splitting

prefix + - # Up/Down controls now needed prefix + |

prefix + CTRL + VIM left/right = tab switching prefix + non CTRL + VIM left/right/up/down = pane switching or prefix + o = cycles panes

Buffer history (getting above visible page)

prefix + escape # (Page) Up/Down controls cursor in buffer mode # Can also copy with space/enter when in buffer mode, this is standard tmux and not custom, google it.

Also, added a list command as a 'help' menu with prefix + f2

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