In the manpage of less the up- and down-arrow keys aren't mentioned in the context of normal navigation, yet on Debian Linux (8.2) they obviously work to scroll up and down. Why is this? A lesskey file is mentioned in the manpage, maybe it is defined there? I can't find this file anywhere, does it exist in the standard installation of Debian?


The manual page, e.g, as you might find on OSX or Unix commands is incomplete:

  • Among other things, less initializes itself using the termcap strings for the cursor keys, home/page keys, pageup/pagedown keys.
  • In most configurations, it is also possible to override the termcap settings with environment variables beginning LESS_TERMCAP_, e.g., LESS_TERMCAP_ku to override the ku (cursor-up) string.

Looking at the source code, there's a table cmdtbl in decode.c which gives initial key-bindings, e.g.,

    'k',0,                          A_B_LINE,
    'y',0,                          A_B_LINE,
    CONTROL('Y'),0,                 A_B_LINE,
    SK(SK_CONTROL_K),0,             A_B_LINE,
    CONTROL('P'),0,                 A_B_LINE,
    SK(SK_UP_ARROW),0,              A_B_LINE,

You may be able to see the pattern here: they all go back one line. But I do not see any of that in the manual page.

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.