11

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.

2
  • If you left click on the window and press Shift + PgUp it should work. This will make your cursor select everything in its path and it will look super ugly, but atleast it works. I would stick to using the scroll wheel for now.
    – Bungicasse
    Feb 23, 2019 at 20:45
  • In PowerShell PageUp and PageDown scrolls up and down the console. Unfortunately running bash inside powershell still doesn't solve the problem
    – phuclv
    Feb 24, 2019 at 12:38

5 Answers 5

4

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.

1
  • This is full and reach in technical knowledge answer to my issue. Thank you!
    – Tomas
    Feb 25, 2019 at 8:07
5

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
6
  • This works well, though I prefered to use multiple instances of {WheelUp} and {WheelDown} to scroll more than the few lines it does by default. e.g. Send {WheelUp}{WheelUp}{WheelUp}{WheelUp} Jun 2, 2019 at 0:19
  • The return are redundant extra lines (since only a single command is in each hotkey), but good idea, I've added it to my AHK library. #IfWinActive ahk_class ConsoleWindowClass +PgUp:: Send {WheelUp} +PgDn:: Send {WheelDown} #IfWinActive. However, how can we extend this to also work for Windows Terminal; do you know the class for that application when using Linux under Windows Terminal?
    – YorSubs
    Oct 30, 2021 at 9:37
  • 1
    @YorSubs: Windows Terminal is detected as ahk_class CASCADIA_HOSTING_WINDOW_CLASS or ahk_exe WindowsTerminal.exe. You may find this by right-click on the AHK icon and selecting "Window Spy", then clicking Windows Terminal.
    – harrymc
    Oct 30, 2021 at 10:03
  • @YorSubs as written, the return are absolutely NOT redundant. they are necessary unless you write the Send command on the same line as the hotkey, directly after the ::
    – mikew
    Jan 10, 2023 at 5:38
  • Sorry @mikew, indeed, good point. I guess for myself I mostly always condense one line hotkeys on the same line since this would be quite tidy, but yeah, you were illustrating long form and the return's are absolutely required in the way you say.
    – YorSubs
    Jan 10, 2023 at 22:04
2

I don't agree with Biswapriyo. The Windows 10 Terminal (Preview) is awesome and using it with VSCode is a pleasure. For instance, it automatically notices when you called code in WSL and starts your Windows VSCode with the Remote Extension—very seamless.

Scrolling is possible with Ctrl+Shift+PgUP. Using both these modifiers seems to be the theme here.

2

I use Windows Terminal. From PowerShell I can SSH into my virtual machines and use Ctrl+Shift+UP/DOWN (arrow keys) to scroll up or down, out of the box. Also works with WSL machines.

0

I found the better way to resolve this I have installed windows-terminal from microsoft and then changed the properties of those with my custom.

Windows terminal is way better than existing powersell or cmd prompt so what we can do is

{ "command": "scrollUp", "keys": "shift+pageup" },
{ "command": "scrollDown", "keys": "shift+pagedowndown" },
  • And issue resolved, And also this allow too much customization :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .