Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Every time I search for a term in less, it stores my search in the file .lesshst. How can I stop this behavior?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

Open a terminal and create a file .lesskey, in your home folder and append the following to it:

#env
LESSHISTSIZE=0

If you already have the file .lesshst in your home folder, then delete it and type the command

lesskey

You should get any errors here. This will not store any history of less from now on, until you change the .lesskey file.

From the man page of less:

ENVIRONMENT VARIABLES

   Environment variables may be specified either in the system environment
   as usual, or in a lesskey  (1)  file.   If  environment  variables  are
   defined  in  more  than one place, variables defined in a local lesskey
   file take precedence over variables defined in the system  environment,
   which take precedence over variables defined in the system-wide lesskey
   file.

LESSHISTSIZE

          The maximum number of commands to save in the history file.  The
          default is 100.

EDIT:

From the comments, I found a better way to prevent having a history file for less.

In the .lesskey file in the home folder, append this:

LESSHISTFILE=-

or

LESSHISTFILE=/dev/null

If you put this in your ~/.bashrc file, this will work, but will have a lower precedence if you have other values in your .lesskey file for the same variables.

You may want to have a look at this:

share|improve this answer
2  
@InkBlend Did you use export? I neuter less in my .bashrc with: "export LESSHISTFILE=/dev/null" –  David Poole Dec 6 '13 at 19:46
1  
Perhaps @Jobin could add the .bashrc + export to his answer. I think he deserves the credit for a good answer. –  David Poole Dec 11 '13 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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