Windows Subsystem Linux terminal scrolling using keyboard

I'm currently using WSL for some shared development and one thing is bothering me: how to scroll terminal up/down in classical UNIX termianl fashion (i.e. using Shift + PgUp or Shift + PgDn)? It does not work with any of common combinations:

  • Shift + PgUp
  • Ctrl + Shift + Up

With or without Shortcuts with Ctrl enabled option.

Any help is appreciated.


Solution 1:

Let have some little introduction. In Windows, Command Prompt is a shell, not a terminal. And wsl.exe is a command line program. There are many terminal emulators with Unix-like terminal features for Windows.

For shared environment, using ssh with WSL (Windows Subsystem for Linux) is better option. Run sshd daemon in WSL with sudo service ssh start command (Here I skip the certificate exchange step). There are many articles and Q&A you can follow. Now the main part i.e. keyboard shortcuts. In Windows side, run ssh user_name@localhost with any terminal emulator like putty, mintty, kitty, MobaXterm, ConEmu etc., all have that page up/down keyboard shortcuts built-in.

If you want to skip the hassle of ssh setup then you can use wsltty, which uses mintty (terminal emulator) and wslbridge (same as ssh but pre-configured). mintty has the keyboard shortcuts like previous examples.

Solution 2:

Mouse scroll works fine, but not the keyboard.

I suggest using AutoHotkey with the following script to enable Shift+PgUp and Shift + PgDn:

#IfWinActive ahk_class ConsoleWindowClass

+PgUp::
Send {WheelUp}
Return

+PgDn::
Send {WheelDown}
Return

#IfWinActive