How To Scroll Up In Linux Terminal – Linux Terminal Scrollback Buffer Navigation

Viewing past commands in the Linux terminal is done by scrolling up through the buffer. If you are new to Linux, you might wonder how to scroll up in linux terminal without using a mouse. This guide will show you every method, from keyboard shortcuts to terminal emulator settings.

The Linux terminal is a powerful tool, but it can feel limiting when you cannot see output that has scrolled off the screen. Fortunately, there are multiple ways to scroll up, and most are faster than using a mouse. Let’s start with the basics and work our way up to advanced techniques.

How To Scroll Up In Linux Terminal

This section covers the most common and effective methods. You will learn keyboard shortcuts, mouse tricks, and command-line tools. Each method works on different terminal emulators, so try a few to see which fits your workflow.

Using Keyboard Shortcuts

Keyboard shortcuts are the fastest way to scroll up. They work in most terminal emulators, including GNOME Terminal, Konsole, and xterm.

  • Shift + Page Up: Scrolls up one full page of output.
  • Shift + Page Down: Scrolls down one full page.
  • Ctrl + Shift + Up Arrow: Scrolls up line by line.
  • Ctrl + Shift + Down Arrow: Scrolls down line by line.
  • Ctrl + Shift + Home: Jumps to the very beginning of the scrollback buffer.
  • Ctrl + Shift + End: Jumps to the very end of the buffer (current input line).

These shortcuts are standard, but some terminal emulators may use different combinations. For example, in the default Ubuntu terminal, you can also use Shift + Up and Shift + Down for line-by-line scrolling. Test them in your terminal to confirm.

Using The Mouse Scroll Wheel

If you prefer a mouse, the scroll wheel works in most graphical terminal emulators. Simply scroll up or down to move through the output. This is the most intuitive method for beginners.

However, the scroll wheel may not work in the console (TTY) or over SSH without X forwarding. For those cases, rely on keyboard shortcuts or the commands below.

Using The less Command

The less command is a pager that lets you scroll through output interactively. It is ideal for viewing long command outputs or log files.

  1. Pipe a command’s output to less: command | less
  2. Use the arrow keys to scroll up and down line by line.
  3. Press Space to scroll down one page, or b to scroll up one page.
  4. Press g to go to the top, and G to go to the bottom.
  5. Press q to exit less.

For example, to view the output of dmesg with scrolling: dmesg | less. This is one of the best ways to scroll up through long outputs without losing your place.

Using The more Command

The more command is an older pager, but it still works. It is simpler than less but less flexible.

  • Use command | more to pipe output.
  • Press Space to scroll down one page.
  • Press b to scroll up one page (if supported).
  • Press q to quit.

Note: more does not support line-by-line scrolling up. For that, use less instead.

Using The screen Or tmux Terminal Multiplexers

If you use screen or tmux, you can scroll up through the scrollback buffer using special keybindings.

In screen:

  1. Press Ctrl + a, then [ to enter copy mode.
  2. Use the arrow keys or Page Up/Page Down to scroll.
  3. Press Esc to exit copy mode.

In tmux:

  1. Press Ctrl + b, then [ to enter copy mode.
  2. Use arrow keys, Page Up/Page Down, or Ctrl + u/Ctrl + d to scroll.
  3. Press q or Esc to exit.

These multiplexers are especially useful over SSH, where the scroll wheel may not work. They also preserve your scrollback history even if the terminal emulator resets.

Adjusting Terminal Scrollback Settings

Sometimes you cannot scroll up because the terminal’s scrollback buffer is too small. You can increase it in most terminal emulators.

GNOME Terminal

  1. Open the terminal and go to Edit > Preferences.
  2. Select your current profile (usually “Unnamed” or “Default”).
  3. Go to the Scrolling tab.
  4. Check “Unlimited scrollback” or set a high number (e.g., 10000 lines).
  5. Click Close.

Konsole (KDE)

  1. Open Konsole and go to Settings > Edit Current Profile.
  2. Click the Scrolling tab.
  3. Set “Scrollback lines” to a high value, like 10000.
  4. Click OK.

Xterm

For xterm, you can set the scrollback buffer size in your .Xresources file:

XTerm*scrollLines: 10000

Then reload with xrdb -merge ~/.Xresources.

Increasing the scrollback buffer ensures you can scroll up through more output, even for long-running commands.

Using The history Command

If you want to scroll up through past commands (not output), the history command is your friend. It shows a numbered list of all commands you typed.

  • Type history to see the last 500 commands (default).
  • Use history | less to scroll through them.
  • To re-run a command, type ! (e.g., !123).
  • To search, use Ctrl + r for reverse search.

This is not exactly scrolling up through output, but it helps you find and re-run previous commands quickly.

Scrolling In The Linux Console (TTY)

The Linux console (accessed with Ctrl + Alt + F1 through F6) does not have a scroll wheel. You must use keyboard shortcuts.

  • Shift + Page Up: Scroll up one page.
  • Shift + Page Down: Scroll down one page.

These work in most console implementations. If they do not, you may need to enable the scrollback buffer in the kernel. Check your distribution’s documentation for details.

Using The tail Command To View Recent Output

Sometimes you only need to see the last few lines of output. The tail command is perfect for this.

  • tail -n 20 filename shows the last 20 lines of a file.
  • command | tail -n 10 shows the last 10 lines of a command’s output.
  • tail -f filename follows a file in real time (like for logs).

This is not scrolling up, but it is a quick way to see recent output without scrolling manually.

Using The grep Command To Search Output

If you need to find a specific line in past output, use grep instead of scrolling manually.

  • command | grep "search term" filters output.
  • history | grep "ssh" finds all SSH commands you typed.
  • dmesg | grep "error" finds error messages.

Combine with less for even more control: dmesg | grep -i "usb" | less.

Using The script Command To Record Output

If you frequently need to review output, use the script command to record your entire terminal session.

  1. Type script to start recording. It saves to a file named typescript by default.
  2. Run your commands as usual.
  3. Type exit to stop recording.
  4. View the file with less typescript or cat typescript.

This is overkill for simple scrolling, but it is invaluable for debugging or documenting your work.

Common Problems And Fixes

Scroll Wheel Not Working In Terminal

This usually happens in the console or over SSH. Use keyboard shortcuts instead. If you are in a graphical terminal, check your terminal emulator’s settings to ensure mouse support is enabled.

Shift + Page Up Does Nothing

This may mean your terminal emulator does not support that shortcut. Try Ctrl + Shift + Up instead. Alternatively, use less to view output.

Scrollback Buffer Is Too Small

Increase the scrollback lines in your terminal preferences, as described earlier. If you are in the console, you may need to adjust kernel parameters.

Output Disappears After Command Finishes

Some commands clear the screen after running. Use command | less to keep the output visible.

Frequently Asked Questions

How Do I Scroll Up In Linux Terminal Without A Mouse?

Use keyboard shortcuts like Shift + Page Up or Ctrl + Shift + Up. You can also pipe output to less and use the arrow keys.

How To Scroll Up In Linux Terminal Using Keyboard?

Press Shift + Page Up to scroll up one page, or Ctrl + Shift + Up to scroll line by line. These work in most terminal emulators.

How To Scroll Up In Linux Terminal In Tmux?

Press Ctrl + b, then [ to enter copy mode. Then use arrow keys or Page Up to scroll. Press q to exit.

How To Scroll Up In Linux Terminal In Screen?

Press Ctrl + a, then [ to enter copy mode. Use arrow keys or Page Up/Page Down to scroll. Press Esc to exit.

How To Scroll Up In Linux Terminal Using Less?

Pipe your command to less (e.g., command | less). Then use b to scroll up one page, or the up arrow to scroll line by line. Press q to quit.

Final Tips For Efficient Scrolling

Mastering how to scroll up in linux terminal will save you time and frustration. Here are some final recommendations:

  • Learn the keyboard shortcuts first. They work everywhere, even in the console.
  • Use less for any command that produces more than a screenful of output.
  • Increase your scrollback buffer to avoid losing important output.
  • If you work over SSH, consider using tmux or screen for persistent scrollback.
  • For repeated tasks, use history and grep instead of scrolling.

With these techniques, you will never struggle to view past terminal output again. Practice them until they become second nature, and you will navigate the command line like a pro.

Remember, the terminal is designed for efficiency. Once you get used to scrolling without a mouse, you will wonder how you ever managed without these shortcuts. Happy command-lining!