You are previewing Getting Started with tmux.
O'Reilly logo
Getting Started with tmux

Book Description

Maximize your productivity by accessing several terminal sessions from a single window using tmux

In Detail

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.

We'll touch on how to perform basic manipulation of text to copy and paste text from one window to another or even from one file to another. We'll learn how to use tmux for fault-tolerant SSH sessions or pair programming, and we finish by discussing some other open source tools that can be used alongside tmux to help make it even more powerful.

By the end of this book, we will have a much better understanding of tmux and its capabilities with the tools necessary to turbocharge our terminal experience.

What You Will Learn

  • Increase productivity by using tmux rather than a mouse to switch between terminal windows
  • Persist sessions on remote machines over SSH with tmux, making it easy to resume right where you left off even if your connection is terminated
  • Learn how tmux can be used to create persistent dashboards for monitoring servers
  • Use tmux to manage multiple terminal windows from a single one
  • Maximize terminal productivity with tmux
  • Maintain the state even when a terminal window is closed with tmux
  • Configure tmux and customize it for your needs
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Getting Started with tmux
      1. Table of Contents
      2. Getting Started with tmux
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. Preface
        1. What you need for this book
        2. Who this book is for
        3. Conventions
        4. Reader feedback
        5. Customer support
          1. Errata
          2. Piracy
          3. Questions
      9. 1. Jump Right In
        1. Running tmux
        2. Sessions
        3. Naming the session
          1. The window string
          2. Creating another window
          3. The prefix key
          4. Help on key bindings
          5. Searching for text
          6. Detaching and attaching
        4. Explaining tmux commands
          1. Tab completion
          2. Aliases
          3. Renaming windows
          4. Killing windows
        5. Summary
      10. 2. Configuring tmux
        1. Using the set-option command
        2. Creating a tmux configuration file
        3. Emacs or vi mode
        4. Enabling mouse modes
        5. Changing the status bar
          1. Modifying the background color of the status bar
          2. Reloading the configuration
          3. Changing the foreground color of the status bar
            1. Highlighting the active window
        6. Binding keys
          1. Viewing current bindings
          2. Chaining multiple commands to a single key
          3. Comments in the configuration file
          4. Binding a new prefix key
          5. Binding keys without the prefix key
        7. Unbinding keys
        8. Status bar revisited
        9. Option types
        10. Handy configuration tips
          1. Binding the double tapping of the prefix key to last-window
          2. Changing the escape time
          3. Lengthening the history limit
          4. Lengthening the display time
          5. Starting the base index at 1
        11. Accessing the man page
        12. Show options
        13. Summary
      11. 3. Sessions, Windows, and Panes
        1. Overviews
          1. Sessions
          2. Windows
          3. Panes
        2. Playing around with sessions, windows, and panes
          1. Multiple sessions
          2. Multiple panes
        3. Working with more panes
        4. Zooming panes
        5. Resizing panes
        6. Switching between panes by number
        7. Cycling through pane layouts
        8. Other pane operations
        9. Summary
      12. 4. Manipulating Text
        1. Explaining the Window history
        2. Explaining the different tmux modes
          1. A sample workflow with Copy mode workflow
          2. Entering Copy mode
          3. Moving the cursor around
          4. Scrolling through the Window history
          5. Jump by search or line
          6. Leaving Copy mode
          7. Copying text into the paste buffer
        3. Interacting with the paste buffer
          1. Pasting text from the paste buffer
          2. Choosing items from the paste buffer
        4. Working with the paste buffer
        5. Summary
      13. 5. Diving Deeper
        1. Understanding tmux commands and Command mode
        2. Advanced paste buffer usage
          1. Saving a paste buffer to a file
          2. Loading a paste buffer from a file
          3. Setting a paste buffer directly
          4. Capturing pane contents in a paste buffer
          5. Deleting copied text from a paste buffer
          6. Clearing the paste buffer history
        3. An advanced session and window usage
          1. Jumping from one window in a session to another window in another session
          2. Moving windows
          3. Linking a window between sessions
        4. Breaking panes
        5. Joining panes
        6. Launching with defaults
        7. Summary
      14. 6. tmux for SSH, Pair Programming, and More
        1. Using tmux over SSH for long lived sessions
          1. Benefits of using Vagrant
          2. Creating a virtual machine with Vagrant
          3. Walking through a sample workflow with tmux over SSH
          4. Launching tmux on SSH connect automatically
        2. Using tmux for pair programming
          1. Connecting to the same session locally
          2. Vagrant Cloud for better security pair programming
          3. Using grouped sessions for pairing
        3. Summary
      15. 7. Using Other Tools with tmux
        1. Using tmux with the OS X Pasteboard
        2. tmux configuration from the maximum-awesome project, by Square
        3. Using tmuxinator to make session management easier
          1. Installing tmuxinator
          2. Understanding the tmuxinator configuration
          3. Revisiting the commented lines
          4. Summarizing tmuxinator
        4. Using wemux to ease multiuser experience
          1. Explaining the wemux modes
          2. Explaining other wemux additions to tmux
        5. Listing other tools to be used with tmux
        6. Summary
      16. A. Appendix
        1. Why tmux?
        2. The configuration reference
        3. Key binding and command reference
          1. Chapter 1 – Jump Right In
          2. Chapter 2 – Configuring tmux
          3. Chapter 3 – Sessions, Windows, and Panes
          4. Chapter 4 – Manipulating Text
          5. Chapter 5 – Diving Deeper
      17. Index