A tmux Crash Course

A tmux Crash Course

I’ve been using tmux for about six months now and it has become just as essential to my workflow as vim. Pane and window management, copy-mode for navigating output, and session management make it a no-brainer for those who live in the terminal (and especially vim). I’ve compiled a list of tmux commands I use daily to help me work more efficiently.


If a tmux command I mention is bound to a keyboard shortcut by default, I’ll note that in parenthesis.

They’re accessed by entering a key combination called the prefix and then typing a letter.

For example, if you see prefix + d below, that means you would first hit (and release) Control + b and then type d.

The prefix can also be changed, which I’ll show you how to do later.

Session Management

Sessions are useful for completely separating work environments. I have a ‘Work’ session and a ‘Play’ session;

  • in ‘Work’, I keep everything open that I need during my day-to-day development,
  • while in ‘Play’, I keep open current open-source gems or other work I hack on at home.
tmux new -s session_name
creates a new tmux session named session_name
tmux attach -t session_name
attaches to an existing tmux session named session_name
tmux switch -t session_name
switches to an existing session named session_name
tmux list-sessions
lists existing tmux sessions
tmux detach (prefix + d)
detach the currently attached session


tmux has a tabbed interface, but it calls its tabs “Windows”. To stay organized, I rename all the windows I use; if I’m hacking on a gem, I’ll name the window that gem’s name. The same thing goes for client applications. That way, I can recognize windows by context and not what application it’s running.

tmux new-window (prefix + c)
create a new window
tmux select-window -t :0-9 (prefix + 0-9)
move to the window based on index
tmux rename-window (prefix + ,)
rename the current window


Panes take my development time from bland to awesome. They’re the reason I was able to uninstall MacVim and develop solely in iTerm2. I don’t have to switch applications to switch contexts (editing, reading logs, IRB, etc.) - everything I do, I do in a terminal now. People argue that OS X’s Cmd+Tab is just as fast, but I don’t think so.

tmux split-window (prefix + ")
splits the window into two vertical panes
tmux split-window -h (prefix + %)
splits the window into two horizontal panes
tmux swap-pane -[UDLR] (prefix + { or })
swaps pane with another in the specified direction
tmux select-pane -[UDLR]
selects the next pane in the specified direction
tmux select-pane -t :.+
selects the next pane in numerical order

Helpful tmux commands

tmux list-keys
lists out every bound key and the tmux command it runs
tmux list-commands
lists out every tmux command and its arguments
tmux info
lists out every session, window, pane, its pid, etc.
tmux source-file ~/.tmux.conf
reloads the current tmux configuration (based on a default tmux config)


These are some of my must-haves in my tmux config:

# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf

# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+


During the day, I’ll work on one or two Rails apps, work on my dotfiles, run irssi, and maybe run vim in another window to take notes for myself. As I mentioned, I run all of this inside one tmux session (named work) and switch between the different windows throughout the day.

When I’m working on any Ruby work specifically, I’ll have a 75%/25% vertical split for vim and a terminal so I can run tests, interact with git, and code. If I run tests or git diff and want to see more output than the 25% allots me, I’ll use tmux to swap the panes and then move into copy mode to see whatever I need to see.

Finally, I run iTerm2 in full-screen mode. Switching between OS X apps for an editor and a terminal is for chumps!

What's next

If you found this article useful, you might also enjoy:

Top Visited
Past week
Past month


Old News ;-)

[Jul 30, 2020] ports tree

Jul 30, 2020 | opensource.com

. On Mac, use Homebrew .

For example, on RHEL or Fedora:

$ sudo dnf install tmux
Start tmux

To start tmux, open a terminal and type:

$ tmux

When you do this, the obvious result is that tmux launches a new shell in the same window with a status bar along the bottom. There's more going on, though, and you can see it with this little experiment. First, do something in your current terminal to help you tell it apart from another empty terminal:

$ echo hello

Now press Ctrl+B followed by C on your keyboard. It might look like your work has vanished, but actually, you've created what tmux calls a window (which can be, admittedly, confusing because you probably also call the terminal you launched a window ). Thanks to tmux, you actually have two windows open, both of which you can see listed in the status bar at the bottom of tmux. You can navigate between these two windows by index number. For instance, press Ctrl+B followed by 0 to go to the initial window:

$ echo hello

Press Ctrl+B followed by 1 to go to the first new window you created.

You can also "walk" through your open windows using Ctrl+B and N (for Next) or P (for Previous).

The tmux trigger and commands More Linux resources The keyboard shortcut Ctrl+B is the tmux trigger. When you press it in a tmux session, it alerts tmux to "listen" for the next key or key combination that follows. All tmux shortcuts, therefore, are prefixed with Ctrl+B .

You can also access a tmux command line and type tmux commands by name. For example, to create a new window the hard way, you can press Ctrl+B followed by : to enter the tmux command line. Type new-window and press Enter to create a new window. This does exactly the same thing as pressing Ctrl+B then C .

Splitting windows into panes

Once you have created more than one window in tmux, it's often useful to see them all in one window. You can split a window horizontally (meaning the split is horizontal, placing one window in a North position and another in a South position) or vertically (with windows located in West and East positions).

  • To create a horizontal split, press Ctrl+B followed by " (that's a double-quote).
  • To create a vertical split, press Ctrl+B followed by % (percent).

You can split windows that have been split, so the layout is up to you and the number of lines in your terminal.


(Seth Kenlon, CC BY-SA 4.0 )

Sometimes things can get out of hand. You can adjust a terminal full of haphazardly split panes using these quick presets:

  • Ctrl+B Alt+1 : Even horizontal splits
  • Ctrl+B Alt+2 : Even vertical splits
  • Ctrl+B Alt+3 : Horizontal span for the main pane, vertical splits for lesser panes
  • Ctrl+B Alt+3 : Vertical span for the main pane, horizontal splits for lesser panes
  • Ctrl+B Alt+5 : Tiled layout
Switching between panes

To get from one pane to another, press Ctrl+B followed by O (as in other ). The border around the pane changes color based on your position, and your terminal cursor changes to its active state. This method "walks" through panes in order of creation.

Alternatively, you can use your arrow keys to navigate to a pane according to your layout. For example, if you've got two open panes divided by a horizontal split, you can press Ctrl+B followed by the Up arrow to switch from the lower pane to the top pane. Likewise, Ctrl+B followed by the Down arrow switches from the upper pane to the lower one.

Running a command on multiple hosts with tmux

Now that you know how to open many windows and divide them into convenient panes, you know nearly everything you need to know to run one command on multiple hosts at once. Assuming you have a layout you're happy with and each pane is connected to a separate host, you can synchronize the panes such that the input you type on your keyboard is mirrored in all panes.

To synchronize panes, access the tmux command line with Ctrl+B followed by : , and then type setw synchronize-panes .

Now anything you type on your keyboard appears in each pane, and each pane responds accordingly.

Download our cheat sheet

It's relatively easy to remember Ctrl+B to invoke tmux features, but the keys that follow can be difficult to remember at first. All built-in tmux keyboard shortcuts are available by pressing Ctrl+B followed by ? (exit the help screen with Q ). However, the help screen can be a little overwhelming for all its options, none of which are organized by task or topic. To help you remember the basic features of tmux, as well as many advanced functions not covered in this article, we've developed a tmux cheatsheet . It's free to download, so get your copy today.

Download our tmux cheat sheet today! How tmux sparks joy in your Linux terminal Organize your terminal like Marie Kondo with tmux. S. Hayes Use tmux to create the console of your dreams You can do a lot with tmux, especially when you add tmuxinator to the mix. Check them out in the fifteenth in our series on 20 ways to be more productive with open source in 2020. Kevin Sonney (Correspondent) Customizing my Linux terminal with tmux and Git Set up your console so you always know where you are and what to do next. Moshe Zadka (Correspondent) Topics Linux

[Jun 22, 2019] Using SSH and Tmux for screen sharing Enable by Seth Kenlon Tmux

Jun 22, 2019 | www.redhat.com

Tmux is a screen multiplexer, meaning that it provides your terminal with virtual terminals, allowing you to switch from one virtual session to another. Modern terminal emulators feature a tabbed UI, making the use of Tmux seem redundant, but Tmux has a few peculiar features that still prove difficult to match without it.

First of all, you can launch Tmux on a remote machine, start a process running, detach from Tmux, and then log out. In a normal terminal, logging out would end the processes you started. Since those processes were started in Tmux, they persist even after you leave.

Secondly, Tmux can "mirror" its session on multiple screens. If two users log into the same Tmux session, then they both see the same output on their screens in real time.

Tmux is a lightweight, simple, and effective solution in cases where you're training someone remotely, debugging a command that isn't working for them, reviewing text, monitoring services or processes, or just avoiding the ten minutes it sometimes takes to read commands aloud over a phone clearly enough that your user is able to accurately type them.

To try this option out, you must have two computers. Assume one computer is owned by Alice, and the other by Bob. Alice remotely logs into Bob's PC and launches a Tmux session:

alice$ ssh bob.local
alice$ tmux

On his PC, Bob starts Tmux, attaching to the same session:

bob$ tmux attach

When Alice types, Bob sees what she is typing, and when Bob types, Alice sees what he's typing.

It's a simple but effective trick that enables interactive live sessions between computer users, but it is entirely text-based.


With these two applications, you have access to some powerful methods of supporting users. You can use these tools to manage systems remotely, as training tools, or as support tools, and in every case, it sure beats wandering around the office looking for somebody's desk. Get familiar with SSH and Tmux, and start using them today.

[Sep 18, 2018] Getting started with Tmux

Sep 15, 2018 | linuxize.com

... ... ...

Customizing Tmux

When Tmux is started it reads its configuration parameters from ~/.tmux.conf if the file is present.

Here is a sample ~/.tmux.conf configuration with customized status line and few additional options:

# Improve colors
set -g default-terminal 'screen-256color'

# Set scrollback buffer to 10000
set -g history-limit 10000

# Customize the status line
set -g status-fg  green
set -g status-bg  black
Basic Tmux Usage

Below are the most basic steps for getting started with Tmux:

  1. On the command prompt, type tmux new -s my_session ,
  2. Run the desired program.
  3. Use the key sequence Ctrl-b + d to detach from the session.
  4. Reattach to the Tmux session by typing tmux attach-session -t my_session .

In this tutorial, you learned how to use Tmux. Now you can start creating multiple Tmux windows in a single session, split windows by creating new panes, navigate between windows, detach and resume sessions and personalize your Tmux instance using the .tmux.conf file.

There's lots more to learn about Tmux at Tmux User's Manual page.

[Jun 28, 2010] TMUX – The Terminal Multiplexer (Part 1) by Cody

See also TMUX – The Terminal Multiplexer (Part 2) Hawk Host Blog
Jun 28, 2010
tmux is similar to screen as it lets you run numerous TTY's in the same terminal window. It supports some very cool and intuitive features natively as well as a much more readable configuration syntax (ever looked at a .screenrc file?).

Why TMUX over Screen?

Well according to the FAQ for tmux it has the following advantages over screen:

  • A clearly defined cilent/server model (windows are their own clients which allows flexibility on how you handle windows. You can attach and detach different windows in different sessions without any issues)
  • Consistent, well-documented command interface. (You can use the same commands interactively as in the .tmux.conf file, more on that later)
  • Easily scriptable
  • Multiple paste buffers
  • Vi & Emacs keybindings
  • A more usable status line syntax (which also allows you to embed the output of a shell command, handy indeed.

Default keybindings & Functionality

The default keybindings for tmux are actually pretty intuitive, though if you're used to screen you'll likely get a little peeved with the default action binding of C-b, though this is easily changed to mimic screens behavior:

*NOTE* If you're like me the Ctrl-b binding isn't horribly intuitive especially if you're used to screen. You can rebind this by putting the following in ~/.tmux.conf:

set -g prefix Ctrl-a

  • Ctrl-b c Create new window
  • Ctrl-b d Detach current client
  • Ctrl-b l Move to previously selected window
  • Ctrl-b n Move to the next window
  • Ctrl-b p Move to the previous window
  • Ctrl-b & Kill the current window
  • Ctrl-b , Rename the current window
  • Ctrl-b % Split the current window into two panes
  • Ctrl-b q Show pane numbers (used to switch between panes)
  • Ctrl-b o Switch to the next pane
  • Ctrl-b ? List all keybindings

Now these are pretty self explanatory – the real magic (for me) of tmux is the ease of modifying the default behavior to do what you want, but first things first: let's explore the default behavior of tmux.

Basic Window Handling

Start up tmux with the tmux command and you should be greeted with a simplistic terminal window that resembles screen – the only difference is it has a default status bar which is nice (easily added to screen as well).

Terminal Multiplexer

Now let's create a couple of windows and go through them (we'll be using the default bindings). Hit Ctrl-b c a few times to create a few windows, you should notice that there are more tabs in the status bar.

Now if you're like me you like to have descriptive names of which each window is for, so let's rename them by hitting Ctrl-b ,. It should prompt you to rename the current window – type anything you want and hit enter. Now the current window is renamed to what you specified. Now going forward I'm going to have two windows open respectively named "window1" and "window2".

Once you rename your windows lets switch back and forth. We have several different ways of switching windows, so I'll go over the ones I personally use:

  • Ctrl-b n (Move to the next window)
  • Ctrl-b p (Move to the previous window)
  • Ctrl-b l (Move to the previously selected window)
  • Ctrl-b w (List all windows / window numbers)
  • Ctrl-b <window number> (Move to the specified window number, the default bindings are from 0 – 9)

Now these ones fairly self explanatory however they don't really cater to a lot of different windows. What if you have 10+ windows open? It becomes quite tedious to find the window you want – but don't fret! Tmux has a find-window option & keybinding. Type Ctrl-b f and type in the window name you want (it actually searches for the window so you can type in only part of the name of the window you're looking for).

You can also get a list of the windows in the current session by executing the list-windows command. To execute commands interactively you type Ctrl-b : which will bring up a text prompt. From there you can execute any command tmux supports interactively (tab completion is supported).

Terminal Multiplexer - Interactive PromptTerminal Multiplexer - List Windows

Basic Pane Handling

One of the most powerful features tmux offers is the ability to split up your current window into "panes". Anyone whose familiar with tiling windows managers will feel quite at home. It's a bit difficult to explain this in words so a simple screenshot will suffice:

Terminal Multiplexer - Split Windows

Now here are some basic key bindings and commands to split the terminal window (vertically and horizontally) and to switch between them

  • Ctrl-b % (Split the window vertically)
  • Ctrl-b : "split-window" (Split window horizontally)
  • Ctrl-b o (Goto next pane)
  • Ctrl-b q (Show pane numbers, when the numbers show up type the key to goto that pane)
  • Ctrl-b { (Move the current pane left)
  • Ctrl-b } (Move the current pane right)

Now some obviously the default bindings don't encompass some of features, such as splitting horizontally. I personally rebind the keys so "|" splits the current window vertically, and "-" splits it horizontally. Not the easiest things to type, though easy to remember.

You can achieve this by putting the following in ~/.tmux.conf or by typing it in the interactive prompt (Ctrl-b :). Keep in mind if you do the latter it will only be in effect for that session:

unbind %
bind | split-window -h
bind – split-window -v

Advanced Window Handling

Now that we went over the basics lets dive a little deeper into some "advanced" features of tmux. This includes moving windows around, linking windows together, switching windows from different sessions and much more. By default tmux doesn't have key bindings for these features, so we'll be entering them in the interactive dialog (accessed by typing Ctrl-b :) – keep in mind tmux is very scriptable and you can easily create your own key bindings for all of these.

Moving Windows

Now if you want to move a window you can use the move-window command. The command to do this:

move-window [ −d] [ −s src-window] [ −t dst-window]

swap-window [ -d] [ -s src-window] [ -t dst-window]

Similar to the above command except both windows have to exist – if they both do the window with the ID source and destination windows will be swapped.

Advanced Pane Handling

When you split up a window into multiple smaller windows they're referred to as panes. Tmux also offers "layouts" for the panes, or the default positioning and behavior when you create a new window. You can switch through the panes by using the key binding Ctrl-b <space> which will toggle through the different layouts. Each one has different behaviors such as main-vertical which means the current active pane will take up more space in the current window, or even-vertical which will split the panes equally. Since this is difficult to describe in text I believe a few screen shots are in order:

Now that you've seen the different layouts let's see what we can do with these panes. As mentioned above in the "Pane Handling" section you can switch through panes by issuing the Ctrl-b o key combination (which is using the down-pane command) or by typing Ctrl-b q which will list the pane ID's and you select the one you want.

Make your pane into its own window

If you want to take a pane and make it into its own window you do the following:

Ctrl-b : "break-pane"

Simple enough, you should now have the pane in its brand new window. If you don't want it to automatically make the pane you just broke out as the active window issue the "-d" switch which will simply break the pane to a new window but keep you in the current window.

Resizing Panes

You can also resize panes if you don't like the layout defaults. I personally rarely need to do this, though it's handy to know how. Here is the basic syntax to resize panes:

Ctrl-b : resize-pane (By default it resizes the current pane down)
Ctrl-b : resize-pane -U (Resizes the current pane upward)
Ctrl-b : resize-pane -L (Resizes the current pane left)
Ctrl-b : resize-pane -R (Resizes the current pane right)
Ctrl-b : resize-pane 20 (Resizes the current pane down by 20 cells)
Ctrl-b : resize-pane -U 20 (Resizes the current pane upward by 20 cells)
Ctrl-b : resize-pane -L 20 (Resizes the current pane left by 20 cells)
Ctrl-b : resize-pane -R 20 (Resizes the current pane right by 20 cells)
Ctrl-b : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells)
Ctrl-b : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)
… etc

Hopefully you get the jist – don't get confused! Simply load up a tmux session and split the window a couple of times and issue the above commands. It should become fairly evident how it behaves after fiddling with it for a bit.

Utilizing the client / server model

I've avoided mentioning that a lot of these commands can actually be applied to numerous tmux sessions which allows quite a bit of flexibility – the reason for avoiding it is it's too much information all at once! An example of using this functionality is if you have two sessions open you can "link" or "move" windows across different sessions – unfortunately the actual "how-to" will be in Part 2.


Tmux may be a bit confusing however it's worth putting in a few minutes to check it out and see what it has to offer – quick easy and intuitive.

Upcoming in Part 2

I'll be going over several tips and tricks for tmux including:

  • Custom hotkeys
  • Custom window styles & colors
  • Scripting with tmux (bash, sh)
  • How to use the server / client model further

TMUX – The Terminal Multiplexer (Part 2) by Cody

July 2, 2010 |Hawk Host Blog
Posted on

In part 1 I went over the basics of tmux and how to utilize its basic features. In this portion I'm going to dive a bit more into customizing tmux to make it easier and prettier to work with. I'll also give some examples on how to utilize the client/server model.

Since this part is less of a tutorial and more of a tips / reference I decided a table of contents based layout would be a bit easier to use:

Note: If you have any tips, tricks or pre-made configurations you want to contribute to this post please do so in the comments and I'll append them to this post.

Note**: You can type the commands into a live tmux session or place them in ~/.tmux.conf file which is automatically loaded when tmux is started.

Modify tmux bindings

Modify tmux looks & style

Misc tips & tricks

Modify tmux bindings

By default tmux has a decent default layout for hotkeys however there are a few keys that either made my fingers contort into ways they shouldn't have or keys I simply always forgot. Luckily tmux offers a very simple syntax to rebind any key.

Rebinding the Action Key

Here is how you can rebind the Ctrl-b prefix to be something a bit easier to type. I personally use Ctrl-a similar to screen:

set-option -g prefix C-a

Note: The "-g" switch stands for global so the binding will affect every window. Alternatively the set-option command accepts arguments to specify the session and target of that particular binding if you like.

Now every subsequent command will be prefixed with Ctrl-a instead of Ctrl-b.

Binding a key for "last-window"

One of my favorite screen hotkeys is the last window hotkey which allows you to quickly switch between the current window and last window that was active. By default tmux doesn't have a binding for this however it can easily be achieved by using the following:

bind-key C-a last-window

What this does is binds Ctrl-a to switch between the last active window. To use this binding you would hit Ctrl-a twice (since the prefix is set to Ctrl-a and the binding Ctrl-a).

Rebinding the pane splitting bindings

One of the most powerful features of tmux is the ability to natively split your windows into several panes. Unfortunately the default bindings to achieve this are simply unintuitive. As a result I've rebound the splitting commands to something I could remember:

unbind % # Remove default binding since we're replacing
bind | split-window -h
bind – split-window -v

At first this may look odd but for me it's easier to remember that "|" splits the screen vertically while "-" splits the screen horizontally. To achieve the below window structure you would type the following sequence:

Ctrl-a |
Ctrl-a –
Ctrl-a –

The first Ctrl-a |command splits the current window in half. The active window is the pane on the right so the subsequent Ctrl-a – splits that window into two vertically. Hitting Ctrl-a – once more now splits that active window into two more by splitting it vertically.

Note: Depending on the active layout you're using the behavior of how the windows split may be different.

Modify tmux look & style

The default colors and style of tmux isn't awful however it's somewhat bland for my liking. I personally only have modified tmux slightly however it allows you to do quite a bit. In this section I'll go over some of tmux's style features.

Modifying tab color & looks

By default the tab colors are pretty bland and it makes it difficult to distinguish the active window from the other windows. Here is the default tmux tabs vs. the modified ones (snippet below):

As you can see the latter version is much more clear and uses some variable expansions tmux provides (hostname, etc). You can achieve this output with the following:

# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left '#[fg=green]#H'

The first two commands set the background to black and the text to white. The third command is where the magic happens: the status-left command tells tmux to display the following text to the left of the terminal. The [fg=green]#H portion tells tmux to display the hostname of localhost and make it green. The #H portion is part of tmux variable expansion – please refer to the man pages for more information on other ones you can use.

That alone doesn't account for highlighting the active window. If you want to do that use the following snippet:

# Highlight active window
set-window-option -g window-status-current-bg red

The set-window-option -g window-status-current-bg red command tells tmux to change the background of the current active window to red. The set-window-option command has several other options you can pass to it to achieve similar affects.

Adding information to your session

Sometimes it might be useful to add some information from your local machine to the tmux screen. Earlier we played with the status-left command which sets the left portion of the status bar. Let's use the status-right command to add some information to the right side:

As you can see I've added the amount of users logged in and the current load average for my computer. This was achieved with the following snippet:

set -g status-right '#[fg=yellow]#(uptime | cut -d "," -f 2-)'

Similar to before the #[fg=yellow] portion tells tmux to make the font yellow. The #(uptime | cut -d "," -f 2-) portion tells tmux to run that cmd and output it on the right of the status bar.

Note: If you're not familiar with shell scripting this command is very simple. It runs the uptime command and then passes it to the cut command which splits it at the commas (,). The -f 2- portion says to print out everything from the second comma onward.

Note**: By default the status bar is redrawn every 15 seconds however you can modify this by setting the status-interval command.

Misc tips & tricks

Using shell scripting to setup your tmux enviroment

Tmux allows you to easily run commands for your different sessions through the command line without having to ever login to the session. This also allows us to make a simple bootstrap script which will setup your tmux environment and log you into it. Here is an example script I personally use:












tmux new-session -d -s hawkhost

tmux new-window -t hawkhost:1 -n 'Server1' 'ssh [email protected]'

tmux new-window -t hawkhost:2 -n 'Server2' 'ssh [email protected]'

tmux new-window -t hawkhost:3 -n 'Server3' 'ssh [email protected]'

tmux new-window -t hawkhost:4 -n 'Server4' 'ssh [email protected]'

tmux new-window -t hawkhost:5 -n 'Server5' 'ssh [email protected]'

tmux select-window -t hawkhost:1

tmux -2 attach-session -t hawkhost

The command new-session -d -s hawkhost creates a new tmux session, detaches it (so it doesn't open in your current terminal) and names it hawkhost in this case.

The following set of new-window commands create five new windows and executes the command at the end. The arguments are broken down as follows: -t hawkhost :1 tells tmux to "target" the session hawkhost and the window with the id of 1. The -n 'Server1' 'ssh [email protected]' portion tells tmux to name the window Server1 and execute the ssh [email protected] command in it.

The last two commands are pretty straight forward. The select-window -t hawkhost:1 command tells tmux that you want the active window the session to be hawkhost and window 1. The -2 attach-session -t hawkhost tells tmux you want to attach the terminal with 256 colors and attach to the session hawkhost.

Note: This is the command that brings the tmux session to the foreground. If you recall earlier when the script created the session we specified the -d switch which prevents it from loading in your terminal.

Notify you when a window has activity

This quick snippet will have tmux notify you in the status area when a window has activity:

# Set window notifications
setw -g monitor-activity on
set -g visual-activity on

As you can see in the first image it lets me know that there was activity in window 0 (in this case sleep 10 && echo "narwhal" and switching the window).

Automatic window rename

You can have tmux rename the window to the command that is currently running. This is useful when you load up something such as irssi and the window is labeled accordingly:

# Automatically set window title
setw -g automatic-rename

tmux, a BSD alternative to GNU Screen

Niall's Weblog
I started using tmux today. Its a terminal multiplexer / task switcher for UNIX-likes, very much in the same vein as GNU Screen. However, its a from-scratch implementation, designed to be clean, sane and easy to configure. The more liberal 3-clause BSD license is a plus also, since it means that OpenBSD has been able to integrate it into the source tree, so that its available out of the box.

Comparison with GNU Screen

I've been a heavy screen user for many years – almost all my work is done on remote screen sessions. However, screen configuration has always been essentially black magic to me. For this reason, tmux and its nice manual page is a breath of fresh air. `tmux list-commands' is very straight forward and easy to grok. Furthermore, I like that everything in tmux is scriptable from the command line – you can run commands like `tmux resize-pane-up -t comms' to resize the pane on a session called 'comms'.

The other thing I really like about tmux is its default status bar. Some people might hate this, but I find it very useful to have a clock and a list of windows along with the process executing in them. This took quite some work to set up to my liking in GNU screen, but the default in tmux is great.

Switching from gnu screen to tmux (updated)


# ` is an interesting key for a prefix
set-option -g prefix `
# set-option -g prefix C-a

unbind-key C-b
bind-key C-a last-window
bind-key ` last-window
bind-key a send-prefix

# we might need ` at some point, allow switching
# we can also send the prefix char with `-a
bind-key F11 set-option -g prefix C-a
bind-key F12 set-option -g prefix `

# 0 is too far from `
set -g base-index 1

# set-option -g default-terminal "screen-256color"
set-option -g mouse-select-pane on
set-option -g status-keys vi
set-option -g bell-action any
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name,active (or not)
set-option -g visual-bell on

setw -g mode-keys vi
setw -g mode-mouse on
setw -g monitor-activity on

bind e previous-window
bind f next-window
bind j up-pane
bind k down-pane

set-option -g status-utf8 on
# set-option -g status-justify centre
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 40

set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black

set-option -g message-fg black
set-option -g message-bg green

#setw -g mode-bg black

setw -g window-status-bg black
setw -g window-status-current-fg green
setw -g window-status-alert-attr default
setw -g window-status-alert-fg yellow

set -g status-left '#[fg=red]#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]'

# set -g status-right '#[fg=green]][#[fg=white] #T #[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'
set -g status-right '#[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'

set -g history-limit 4096

# `+r reloads the configuration, handy
bind r source-file ~/.tmux.conf

[Mar 29, 2010] tmux: a replacement for gnu screen (updated)

March 29, 2010

I have recently discovered tmux, a replacement for the slightly aging gnu screen. The so called "terminal multiplexer" allows to open several terminals inside the same terminal window. Much like gnu screen, you can split the screen, resize the different parts etc. However, tmux allow the usage of 256 color terminals and is based upon a client server infrastructure. And before you ask, like screen, it will stay alive and run your favorite app until you reconnect to the session.

It is part of the OpenBSD base distribution but will compile and run on a number of OS including Linux. Solaris, AIX, etc.

Update: for Mac OS users, it is available from macports.

Recommended Links

Google matched content

Softpanorama Recommended

Top articles


tmux - Wikipedia

tmux - ArchWiki

Tmux Cheat Sheet & Quick Reference




tmux(1) - Linux manual page



Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy


War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes


Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law


Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D

Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site


The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: July, 31, 2020