Linux

Where Does less Store Keybindings and History?

less reads keybindings from ~/.lesskey (compiled with lesskey) on Linux, with $LESS options and .lesshst history beside it in modern builds.

Last updated

less customizes through a small constellation in home. The ~/.lesskey source file defines extra keybindings once compiled. Environment options ride in $LESS for colors and behavior. Newer builds append search history to .lesshst.

Compilation trips everyone once. Less never reads the source file directly, only the compiled output lesskey produces. Treat the source as code and the binary as build artifact, and the workflow clicks immediately.

Where less stores this, by platform

Linux
~/.lesskey

Keybinding source compiled with lesskey into .lesskey.bin. $LESS options and .lesshst history complete the setup. Delete history file to clear recall.

Frequently asked questions

How do lesskey bindings take effect?

Write bindings in ~/.lesskey then run lesskey to compile them into ~/.lesskey.bin which less actually reads. Editing the source alone changes nothing until compiled. Modern less also honors $LESSKEYIN for alternate paths.

How do I stop less history tracking?

Set LESSHISTFILE=- to disable it or point it elsewhere in shell rc. The file records search history across sessions. Deleting it clears recall without affecting bindings.

Notice an outdated path? Let us know.