I've grown quite weary of shift-pgup to page up in gnome terminal, the command line, terminator, and guake, etc.
Any way to easily make these apps use the straight page-up and page-down keys for paging around?
I've grown quite weary of shift-pgup to page up in gnome terminal, the command line, terminator, and guake, etc.
Any way to easily make these apps use the straight page-up and page-down keys for paging around?
I am afraid this is not possible, as no PgUp/PgDown will be sent to command-line applications, which will render some of them unusable. This is a good old days Unix feature.
If you want more user-friendly scrolling, I suggest using the
less
command. It's used this way:This will start the
less
command with output of your original command. (*More about piping output to other programs can be found here.less
can be navigated using arrows or PgUp/PgDown. For your convenience it also provides searching and more (seeman less
for more). You can quitless
by pressing theq
key.Use
xterm
and tweak the keybindings (in~/.Xresources
) like this:gnome-terminal
says PageUp/PageDown is for applications within the terminal and using them would be confusing...Konsole is a terminal emulator for KDE that provides relevant option, in which can be configured to use Page Up and Page Down keys for direct paging. There are no other terminal emulators that I found as easy as Konsole for such customization.
How to direct paging
In Konsole, do the following steps.
In menu bar, go to "Settings" and click "Configure Current Profile..." (Kubuntu 12.04) or "Edit Current Profile..." (Kubuntu 16.04) and a window will appear.
Click on "Input" tab (Kubuntu 12.04) or "Keyboard" tab (Kubuntu 16.04), which has a section called "Key Bindings" with predefined lists of key bindings.
Select "Default (XFree 4)" and click "Edit..." button, then another window will appear.
Scroll down and look for key combination
PgDown-Shift-AnyModifier
with output\E[6~
. Rename this output toScrollPageDown
.Scroll down and look for key combination
PgUp-Shift-AnyModifier
with output\E[5~
. Rename this output toScrollPageUp
.Click "OK" button to finish and close the windows.
How to test output
In step 3, there is "Test Area" to confirm the output for each key press.
Click to bring focus in "Input:" text field and press Page Up and Page Down keys (one at a time).
Confirm the output to be the same as renamed ones.
Or, write a simple script to echo message in loop. I have included my own script as following.
Copy and paste the following lines of code in text editor.
Save as file i.e.
loop.sh
and run the script in terminal i.e.bash loop.sh
(non-executable).Wait until the echoed messages fill the viewing area and started to scroll output downwards.
Then, press Page Up and Page Down keys to scroll up and scroll down the viewing area.
I have tested using Konsole 2.8.5, KDE 4.8.5 in Kubuntu 12.04.
Bonus: Key combination and output
Alright, bonus answer for clarification. One may wonder why I had to edit those key combination and not others. I had figured that out earlier by testing several types of keyboard.
The following are default key combination and its output, which have been figured out using "Test Area" in Konsole.
For primary Page Up/Page Down keys (including keyboard variant that requires to press Fn key a.k.a. Fn+PgUp/Fn+PgDn):
Key combination:
PgDown-Shift-AnyModifier
Output:\E[6~
Key combination:
PgUp-Shift-AnyModifier
Output:\E[5~
For secondary Page Up/Page Down keys (default shortcut in terminal that requires Shift key a.k.a. Shift+PgUp/Shift+PgDn):
Key combination:
PgDown+Shift-AppScreen
Output:ScrollPageDown
Key combination:
PgUp+Shift-AppScreen
Output:ScrollPageUp
Notice that minus
-
and plus+
signs differ between each keywords for primary and secondary keys. Those are how key presses are translated into equivalent characters, at least in Konsole.However, I'm unsure if those equivalent characters are actually understood by other terminal emulators. This is as far as I know by own experience.
Verdict
For power users who don't like dealing with various configuration files and such tedious workarounds, Konsole will easily win your heart. It seems that nobody had noticed to this level of customization offered by Konsole and KDE for the past four years. How strange.
You can use the
more
command like this:this will start your command original output with more.
more
can be navigated with 'space'. Just press the space and see the output of the command as pages.