How to Scroll in Tmux [3 Easy Ways]

Written by

Reviewed by

Last updated: June 2, 2024

Expert verified

SVG Image

TL;DR

To scroll in Tmux, you can try these methods:

  1. Activate Tmux commands with Ctrl+b, enter copy mode with [, scroll using arrow keys, and exit with q.
  2. Enable mouse scrolling in Tmux by adding set-option -g mouse on to ~/.tmux.conf, saving the file, and using the mouse wheel or scrollbar to navigate through panes and windows.
  3. Use Ctrl+b followed by Page Up or Page Down to scroll through the output of an entire Tmux window.

Explore the article below to learn to scroll in Tmux, essential key bindings to use, and common errors that can occur.

Managing multiple Terminal sessions can be a challenge, but Tmux turns this complexity into a streamlined experience. If you’re struggling to keep track of extensive outputs across various sessions, this post is your solution. Here, I will explore different methods to scroll in Tmux, so you can effortlessly navigate and control your terminal’s history. Expect practical tips on using key bindings and mouse scrolling alongside solutions to common errors to enhance your Tmux efficiency.

How to Scroll in Tmux?

To scroll in Tmux, first ensure that mouse support is enabled by adding set -g mouse on to your .tmux.conf file, then restart Tmux. For keyboard scrolling, enter copy mode by pressing Ctrl-b [ and use the arrow keys to navigate up and down. To exit copy mode, simply press q. This setup allows you to move through your terminal output efficiently, whether you prefer using the mouse or the keyboard.

That was the quick answer. Here is the detailed step-by-step guide to scroll in Tmux:

1. Key Bindings (Copy Mode)

Tmux allows you to enter copy mode, where you can scroll through the terminal output using key bindings. This method provides fine-grained control and precision while scrolling, allowing you to review past output or navigate through logs. Follow these steps:

  1. Press Ctrl+b (default prefix) to activate Tmux commands.
activating command mode in tmux
  1. Press [ to enter copy mode and use the arrow keys to scroll up and down in Tmux.
scrolling through arrow keys in tmux 1
  1. Press q to exit copy mode.
exiting copy mode in tmux

2. Tmux Scroll with Mouse

If your terminal emulator and Tmux configuration support it, you can use your mouse to scroll up and down in Tmux panes and windows. Mouse scrolling offers a more intuitive and effortless way to navigate through large amounts of Terminal output, particularly useful when working with graphical applications or lengthy logs. Here are the steps to do it:

  1. Ensure that your Terminal emulator supports mouse input within Tmux by opening the configuration file of Tmux using the following command:
vi ~/.tmux.conf
  1. The command will open the configuration file.
entering tmux configuration file 1
  1. Enter the following command to enable the mouse in Tmux:
set-option -g mouse on
  1. Save this file and exit.
eanbling mouse in tmux configuration file
  1. Hover the cursor over the Tmux pane or window where you want to scroll. Use the mouse wheel or drag the scrollbar to scroll up and down in Tmux.
scrolling through mouse wheel in tmux

3. Key Bindings (Window Scrolling)

Tmux provides specific key bindings for scrolling within windows, which are separate instances of Terminal sessions. This method allows you to scroll through the output of an entire Tmux window, which may consist of multiple panes, providing a broader overview of the session’s history. Here are the steps to do it:

  1. To activate the Tmux command mode, press Ctrl+b.
  2. Press Page Up or Page Down to scroll through the window’s output.
pressing keys to scroll

Key Bindings for Effective Scrolling in Tmux

Explore the Tmux Scrolling Key Bindings Table to navigate through Terminal outputs efficiently. This table offers essential shortcuts for seamless scrolling, making your Tmux sessions more manageable and productive.

ActionKey BindingDescription
Enter Copy ModeCtrl-b [Enters copy mode to allow keyboard navigation and selection.
Scroll Up One PageCtrl-b PageUpScrolls up one full page in the current tmux pane.
Scroll Down One PageCtrl-b PageDownScrolls down one full page in the current tmux pane.
Scroll Up One LineUp Arrow (in copy mode)Scrolls up one line at a time while in copy mode.
Scroll Down One LineDown Arrow (in copy mode)Scrolls down one line at a time while in copy mode.
Exit Copy Modeq (in copy mode)Exits copy mode and returns to normal operation.

4 Common Errors with Possible Solutions

While using Tmux, you may encounter some common errors. Reading and understanding the error message is helpful in finding the best solution. Here are four frequent errors and their possible solutions:

  • 🔄 Unresponsive Scroll Commands: Sometimes key bindings for scrolling don’t respond. This could be because they conflict with your terminal emulator’s shortcuts. Check your .tmux.conf for key bindings like set-window-option -g mode-keys vi for Vi-like keys, or adjust them to avoid conflicts.
  • ⚙️ Slow Scroll Performance: Slow scrolling in Tmux can occur when your system is under heavy load, or Tmux is processing a lot of data. To improve performance, consider increasing the history limit in smaller increments or reducing it if it’s excessively high with set-option -g history-limit 1000.
  • Incomplete Scrolling in Buffer: If you find that not all expected output is available when you scroll back, your history limit may be set too low. Adjust this by adding or modifying set-option -g history-limit 5000 in your .tmux.conf, which increases the number of lines Tmux stores.
  • 🛑 Erratic Scrolling Behavior: Erratic behavior when scrolling, such as jumping or skipping lines, can often be resolved by updating Tmux to the latest version or resetting your configuration to default settings to eliminate any custom commands that may be causing issues.

Tmux Scroll Up and Down: A Key to Terminal Efficiency

In this article, I have discussed several methods to scroll up and down in Tmux, including keyboard shortcuts, the scroll wheel on your mouse, and adjusting the scroll speed. Furthermore, I have also discussed some common errors with possible solutions. 

If you’re interested in exploring Tmux further, I encourage you to read articles on Tmux configurations and productivity hacks, Tmux plugins and integration with other tools, and how Tmux integrates with other command-line tools. By reading these articles, you can unlock Tmux’s full potential and become a master of this powerful terminal multiplexer. 

Frequently Asked Questions

Are there any plugins specifically designed to improve scrolling in Tmux?

Yes, there are plugins like tmux-yank and tmux-resurrect that enhance scrolling and session management in Tmux. These plugins aid in copying text more efficiently and saving session states, which indirectly improve how users interact with the scrollback buffer, making navigation and recovery more intuitive.

What are the differences between vertical and horizontal scrolling in Tmux?

Vertical scrolling in Tmux moves the view up or down through the terminal output, which is useful for reviewing command history and output. Horizontal scrolling, however, shifts the view left or right, ideal for examining wide outputs that don’t fit the pane width.

Is it possible to scroll through the Tmux scrollback buffer indefinitely?

By default, Tmux has a limit on the number of lines stored in the scrollback buffer. However, you can configure Tmux to increase this limit or set it to an unlimited value. In your Tmux configuration file (~/.tmux.conf), you can add the line set-option -g history-limit <number_of_lines> to adjust the buffer size. Replace <number_of_lines> with the desired value or set it to unlimited to scroll through the buffer indefinitely. Keep in mind that setting an excessively large buffer size may consume more memory, so consider your system resources when modifying this setting.

How do I adjust the scroll speed in Tmux?

To adjust the scroll speed in Tmux, edit the .tmux.conf file to modify mouse scroll sensitivity. For example, add set -g mouse-speed 3 5 to change vertical and horizontal scroll speeds, respectively. Higher numbers result in faster scrolling, enhancing navigation through long outputs.

Is it possible to sync scrolling across multiple panes in Tmux?

Yes, Tmux supports synchronized scrolling across multiple panes, which can be especially useful when comparing similar outputs in parallel. To enable this, use the command setw -g synchronize-panes on in your Tmux session. This command aligns the scroll position of all panes within the same window.

Ojash

Author

Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

Akshat

Reviewer

Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

Share this article
Shareable URL
Prev Post

5 Easy Methods to List Mounted Drives Linux

Next Post

3 Easy Methods to Check Linux Login History

Leave a Reply

Your email address will not be published. Required fields are marked *

Read next