Skip to content

Instantly share code, notes, and snippets.

@sneeu
Created December 17, 2013 15:47
Show Gist options
  • Save sneeu/8007014 to your computer and use it in GitHub Desktop.
Save sneeu/8007014 to your computer and use it in GitHub Desktop.

tmux intro

What is it?

A terminal multiplexer, much like screen.

Allows you to run multiple virtual terminals in a single terminal.

Why is it better than screen?

A few more features, but the big one is panes.

Sessions, windows & panes

  • tmux runs as a client-server.
  • A client can create & destroy sessions; connect to & disconnect from existing sessions.
  • Multiple clients can connect to the same session (perhaps for pair programming).

A session can have many windows; only one window is shown at a time.

A window can be split into one or more panes.

Zoom

In more recent versions of tmux, panes can be zoomed into.

Status line

tmux has a status line, which can be customised to show all sorts of stuff, I have it show me my session name (to remind me what I'm doing), which windows I have open, the date, and my battery charge.

It can be configured to update as often or as little as you like.

Scrolling, copy & pasting

tmux can scroll, copy, and paste, although it's a bit fiddly.

Scrolling

Start scroll mode

<C-a> [  # I remapped the prefix from <C-b> to <C-a>

Scroll up/down with standard pager keys:

<C-u>  # => One screen up
<C-d>  # => One screen down
j/k    # => One line down/up

Copy/pasting

Is a bit of a nightmare, but it can be tamed with some configuration.

Time

<C-a> t

BONUS!

tmuxinator is a popular tool for automatically sending commands to a tmux session, which can be useful for starting workspaces.

I don't use it.

DOUBLE BONUS!

vim-slime, which I used in my last presentation allows you to send commands from a vim instance to tmux pane, which is handy.

tmux.conf

Is on GitHub

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