218

How can I scroll in bash using only the keyboard? If it's not possible in bash, are there any other shells that support this?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Kshitiz Sharma
  • 8,585
  • 21
  • 59
  • 75
  • 45
    This is not a feature of the shell, it's a feature of the terminal emulator. See [What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?](http://unix.stackexchange.com/q/4126) What terminal are you using? – Gilles 'SO- stop being evil' Jan 05 '13 at 17:22
  • 1
    I think this is too broad. As mentioned, scrolling is a terminal emulator feature, not a shell feature. There are *really very many* terminal emulators many of which implement scrolling in different ways, or not at all. – Anko - inactive in protest May 11 '15 at 17:39
  • 2
    On that score: For a question specifically about GNOME Terminal, although the questioner initially _also_ did not specify the terminal emulator program, see https://unix.stackexchange.com/questions/460422/ . – JdeBP Aug 14 '18 at 11:42

12 Answers12

239

In "terminal" (not a graphic emulator like gterm), Shift+PageUp and Shift+PageDown work.

isevcik
  • 2,594
  • 1
  • 14
  • 8
57

I use the default terminal in Ubuntu 14 (bash) and to scroll by page it is Shift + PageUp or Shift + PageDown to go up/down a whole page.

Ctrl + Shift + Up or Ctrl + Shift + Down to go up/down by line.

hg8
  • 1,420
  • 3
  • 16
  • 25
max pleaner
  • 753
  • 1
  • 6
  • 15
18

This depends on your terminal emulator, not the shell you are using. I personally use GNU Screen. From the description:

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.

You can use C-a [ to enter scrollback mode. From here, you can scroll with the keyboard and even copy and paste. The mode can be exited from by using the Esc key.

mitchus
  • 161
  • 1
  • 9
jordanm
  • 41,988
  • 9
  • 116
  • 113
17

Keyboard: Apple/Mac

Terminal/Emu: OSX Terminal

Shell: bash

fn + up_arrow: page up
fn + down_arrow: page down
cmd + up_arrow: line up
cmd + down_arrow: line down
Shaun Wilson
  • 105
  • 4
zero_day
  • 189
  • 1
  • 2
  • 4
    This adds nothing, appears to be mac specific (which would not be a bad thing if properly marked as such), and does not apply to bash but to the terminal emulator (which would be useful if we knew what it was). – hildred Aug 08 '15 at 15:51
7

On FreeBSD, you can use Scroll Lock to toggle screen scrolling mode. Press it once, then use Up/Down, PgUp/PgDown, Home/End to scroll. Press it again to jump back down and resume typing.

mwfearnley
  • 1,104
  • 1
  • 16
  • 19
6

In most terminals that I known you can use Shift+PageUp and Shift+DownDown for scrolling. Note that some terminals don't support scrolling, or use a very limited history buffer. In the latter case, you may want to increase the limit, if it is configurable.

As an alternative, use a pager; for example, less.

Philipp Claßen
  • 4,689
  • 7
  • 29
  • 41
3

I access a container via an Ubuntu 16.04 LTS terminal, from a Windows machine. I needed to use space (when inside a bash session on a Docker container running Linux Ubuntu).

  • 1
    Please consider adding some more information on the virtual environment of your container (such as OS type/version, bash version etc.) so that readers may better assess the applicability of your answer to their specific situation. – AdminBee Jan 16 '20 at 08:15
  • What ... pressing space? – user26742873 Aug 27 '21 at 14:49
2

There is an another way to show everything in terminal organized write to the last to any command " | less " and by clicking SPACE BUTTON you can scroll down an up.

Examples

  • ps aux
  • ps aux | less

  • ps fax

  • ps fax | less
slm
  • 363,520
  • 117
  • 767
  • 871
2

Linux on Apple / Mac Keyboard (at least on MacBook Pro)

  • Page-up: shift+fn+UpArrow
  • Page-down: shift+fn+DownArrow
  • Line-up: shift+control+UpArrow
  • Line-down: shift+control+DownArrow
  • Home: shift+fn+LeftArrow
  • End: shift+fn+RightArrow
1

If you use VirtureBoxVM on Mac OS, press SHIFT + fn + up_arrow ( or down_arrow) to roll.

1

I don't have PgUp so I use Fn+Shift+UpArrow

AdminBee
  • 21,637
  • 21
  • 47
  • 71
1

Its also depend on your keyboard PageUp/Down and arrow keys layout. Here is my keyboard layout and I am using Ubuntu.

Keyboard

Answered by @Guzman is working for me.

Page-up: shift+fn+UpArrow
Page-down: shift+fn+DownArrow
Line-up: shift+control+UpArrow
Line-down: shift+control+DownArrow
Home: shift+fn+LeftArrow
End: shift+fn+RightArrow
Gagan
  • 121
  • 2