How to disable log feature of less command

less

I use the less command a lot to view files, but when viewing a file, sometimes accidentally I type the s key within less, activating then the log feature. If I don't notice that log in the bottom of the terminal and keep typing (such as searching for a pattern), a file may be created in the current directory.

According to man less, there is a "secure" mode for less, when the environment variable LESSSECURE is set to 1, but this will disable several more features, I only want to disable the log feature.

I never use the log feature in less. How can I disable the log feature of less?

Best Answer

Create a file setting a new key binding for the s command key, and "compile it" as follows:

echo 's invalid' >~/.lesskey
lesskey

Then typing s in less will just beep or flash.

Related Question