Book Image

Getting Started with tmux

By : Victor Quinn
Book Image

Getting Started with tmux

By: Victor Quinn

Overview of this book

Table of Contents (16 chapters)
Getting Started with tmux
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

tmux is rapidly becoming the de facto standard with regards to terminal multiplexers with its breadth of features and ease of configuration. It is one of the fastest growing tools in the developer's toolkit due to its power in maximizing the productivity of a terminal window. Developers spending a large amount of time in the terminal will benefit greatly from learning how to utilize tmux and its powerful features. By taking a single terminal window and turning it into multiple windows, each with their own state, tmux is like a supercharger for your console.

We will begin with a simple introduction to tmux and learn some ways in which it can help increase productivity in your daily terminal usage. From there, we'll move on to configuring and customizing tmux to make it work, look, and feel the way that best suits your needs. Along the way, we have tutorials and screenshots aplenty so that you can follow along and avoid feeling lost. We'll also explain some of the core concepts of tmux, including the way it uses sessions, windows, and panes in order to divide content and running programs.

After learning some of these beginner topics, we will dive into some advanced tmux concepts. We'll touch on how to perform text manipulation to copy and paste text from one window to another or even to and from a file. We'll learn how to use tmux for fault-tolerant SSH sessions or pair programming, and we will finish by discussing some other open source tools that can be used alongside tmux in order to help make it even more powerful.

tmux is an incredibly capable tool, which has some concepts that can be tricky to grasp. This book will help demystify some of these tricky bits with many explanations and rich examples in a manner that cannot be found in the tmux man page.

By the end of book, you will have a much richer understanding of tmux and its capabilities and all the tools necessary to turbocharge your terminal experience. This book covers the following topics:

Chapter 1, Jump Right In, will have us really hit the ground running, taking us through a typical tmux workflow, explaining everything along the way. This allows us to experience how tmux can be useful and illustrating how it can be integrated into your daily workflow.

Chapter 2, Configuring tmux, will teach us how to change and configure almost anything about tmux's behavior, from the way it looks and feels to the commands it executes on the load. You can even configure every key combination to which tmux responds. In this chapter, we will cover the various ways to configure tmux and customize it for your workflow.

Chapter 3, Sessions, Windows, and Panes, will help us learn all about sessions, windows, and panes. These are the fundamental components that make up the window management feature of tmux and this chapter will help us understand what they are and how they relate. We will learn, through example, many ways we can work with them in order to turbocharge our terminal with tmux.

Chapter 4, Manipulating Text, helps us learn about the powerful tools of tmux for text manipulation. These tools take the form of Copy mode and paste buffers, and we will learn more about them and how to use them for very powerful text manipulation with features such as scrolling through text that has scrolled off screen and copying text from anywhere in the window history and pasting it, often without ever needing to reach for your mouse.

Chapter 5, Diving Deeper, touches on some more nuanced aspects of topics we have covered already. These topics include tmux commands and its Command mode, advanced paste buffer usage, and some advanced usage of windows and panes. We'll finish it off with learning how to launch a tmux session with some default windows.

Chapter 6, tmux for SSH, Pair Programming, and More, will walk us through a couple of usage patterns that can prove to be powerful. It will help us learn about using tmux over SSH for long-lived sessions for pair programming, and along the way, we will use Vagrant for some predictability and security.

Chapter 7, Using Other Tools with tmux, will allow us to discuss some third-party tools that can run along with tmux and add more powerful features. We'll learn about tmuxinator, which simplifies the tmux launch configuration and wemux, which brings the tmux multiuser experience to a whole new level. We'll learn about these along with a few other tricks and utilities.

Appendix contains three sections, namely Why tmux?, The configuration reference, and Key binding and command reference.

What you need for this book

A computer running tmux 1.8+ (Unix, Linux, or OS X) which can be downloaded from the following link:

http://tmux.sourceforge.net

Who this book is for

The book is intended for software developers, DevOps engineers, and other professionals who make heavy use of the terminal in their daily workflow. Some familiarity with the terminal is useful but no prior experience with tmux or other terminal multiplexers (such as GNU Screen) is required.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

When we are describing a key to press, it will appear in italics, like this: "Please press the letter b now" Often we will describe a key combination, which means pressing multiple keys at the same time, it will appear like this: Ctrl + b. That means hold down the Control key and press the letter b. We will also see multiple key combinations, to be pressed in series. They will appear separated by a comma and will appear like this: Ctrl + b, c. That means hold down the Ctrl key and press the letter b, then release both keys and press the letter c.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Simply run the tmux command show-options with a flag for which set of options you want to view."

A block of configuration code is set as follows:

# Set the status bar background to blue
set-option -g status-bg blue
# Set the status bar text to white
set-option -g status-fg white

# Set the active window background in the status bar
set-window-option –g window-status-current-bg magenta

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

# Set the active window background in the status bar
set-window-option –g window-status-current-bg magenta

# Rebind the prefix key
set-option -g prefix C-t

# Add a key binding for reloading our configuration
bind-key C-r source-file ~/.tmux.conf

Any command-line input or output is written as follows:

$ tmux attach-session –t tutorial

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "You will see Search Up: appear in the lower left-hand corner."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

You can also follow or tweet the author directly on Twitter as @victorquinn.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.