Introduction to Tmux

Fri Sep 02 2016

Introduction to Tmux

tmux is a “terminal multiplexer”, it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. tmux is intended to be a simple, modern, BSD-licensed alternative to programs such as GNU screen.

Install tmux.

tmux depends on libevent 2.x. Download it from: libevent.org

From source

By default, tmux will use the utempter library to update utmp(5), if it is installed. Run configure with --disable-utempter to disable this.

To build tmux from a release tarball, do:

$ ./configure && make
$ sudo make install

To get and build the latest from version control:

$ git clone https://github.com/tmux/tmux.git
$ cd tmux
$ sh autogen.sh
$ ./configure && make

Install tmux in Mac OSX

Yes, you can do brew install tmux

Starting Tmux You can start a tmux session by tmux attach or simply tmux a command.

Managing the configuration.

You can manage all the configurations with .tmux.conf file. Which will reside in your home folder. You can check with cat ~/.tmux.conf to see whether there is any.

Multiple Pane Synchronization

What setw synchronise-panes gives us is that it simultaneously sends keyboard input from one pane to the rest of the panes. (In this case, we can also see the the Elixir REPL is far superior because of the colored output.)

Obviously, this demonstration is a mere party trick to impress developers and nothing more. A good use case is having to perform a repetitive operation on multiple machines. For example, imagine having a tmux session connected to four remote hosts and having to executer the exact same command on all of them.

Noteworthy plugins.

1. Tmux Plugin Manager

Installs and loads TMUX plugins.

2. tmux-resurrect

Restore tmux environment after system restart.

Tmux is great, except when you have to restart the computer. You lose all the running programs, working directories, pane layouts etc. There are helpful management tools out there, but they require initial configuration and continuous updates as your workflow evolves or you start new projects.

3. tmux-sensible

A set of tmux options that should be acceptable to everyone.

This is how my own .tmux.conf file looks like, i shall explain what all are there.

Some good reads

  1. thoughtbot.com
  2. quora.com

This article originally appeared on lightrains.com

Leave a comment

To make a comment, please send an e-mail using the button below. Your e-mail address won't be shared and will be deleted from our records after the comment is published. If you don't want your real name to be credited alongside your comment, please specify the name you would like to use. If you would like your name to link to a specific URL, please share that as well. Thank you.

Comment via email
Nikhil M
Nikhil M

Entrepreneur / Privacy Freak / Humanist / Blockchain / Ethereum / Elixir / Digital Security / Online Privacy

Tags Recent Blogs