Why does .lesshst keep showing up in my ~
Solution 1
FIlenames starting with . are (lightly) hidden files. They're often use by programs to record configuration or usage information. Sometimes that's recorded from the last time you used the program; that's the case with less
and the .lesshist
"history" file.
If you aren't sure which program created the file, a websearch will usually answer the question... so I'm leaving understanding the rest of those files as an Exercise For The Reader.
Solution 2
A .lesshst file will be generated in one’s home directory if one uses the man
command to view documentation; performs a search within such documentation by using the / key, typing a search term, and pressing the Enter key to begin a search; and subsequently exits the man
command documentation using the q key.
Apparently, one can use the data in this file to perform a man
command search using the last used search term the next time one uses the man
command to view documentation. (This would be accomplished by pressing the search key combinations N or Shift+N after having generated a .lesshst file.) It's not clear to me what the benefit of storing search terms preceding the last is though.
Solution 3
You can disable the creation of the ~/.lesshst
file by setting the LESSHISTFILE
variable to -
.
export LESSHISTFILE=-
You can also set the above to another valid file path to have the less
command use that file instead. I like to do the following in my ~/.xprofile
file:
export LESSHISTFILE="$XDG_STATE_HOME"/less/history
As for your git
stuff, Git
probably wasn't the program that created the ~/.config
folder. That folder is part of the XDG Base Dirs specification, and git
actually respects this specification. In short all you need to do is:
mv -T ~/.gitconfig $XDG_CONFIG_HOME/git/config
mv -T ~/.gitignore_global $XDG_CONFIG_HOME/git/ignore
Also see Arch Wiki for XDG Base Directory
Solution 4
I just looked into that this morning. Because of my OCD, I wanted to move the .lesshst file from my $HOME
and put it in my $XDG_LOG_HOME
.
For less:
I created a lesskey-file in $XDG_CONFIG_HOME
called "lesskey", in this lesskey-file, I set the LESSHISTFILE environment variable to the path of my future less-history-file (in $XDG_LOG_HOME
). If you already have a lesskey just add to it.
Then in my zshrc (or bashrc) I set the following line :
alias less='less --lesskey-file=$XDG_CONFIG_HOME/lesskey'
That does the trick only when using less
For man:
I put the following line in my zshrc (or bashrc):
alias man='man --pager="less --lesskey-file=$XDG_CONFIG_HOME/lesskey"'
That does the trick with man ! I tried to use more but it does not seem to generate a .lesshst in $HOME
Solution 5
You may be using less
without knowing it. From the man
page:
COMPATIBILITY WITH MORE
If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link
named "more", less behaves (mostly) in conformance with the POSIX "more" command specification.
In this mode, less behaves differently in these ways:
The -e option works differently. If the -e option is not set, less behaves as if the -E option
were set. If the -e option is set, less behaves as if the -e and -F options were set.
The -m option works differently. If the -m option is not set, the medium prompt is used, and it
is prefixed with the string "--More--". If the -m option is set, the short prompt is used.
The -n option acts like the -z option. The normal behavior of the -n option is unavailable in
this mode.
The parameter to the -p option is taken to be a less command rather than a search pattern.
The LESS environment variable is ignored, and the MORE environment variable is used in its place.
Scott
Updated on August 27, 2021Comments
-
Scott almost 3 years
I never use
less
, and have always usedmore
. It is what I was introduced to, which is probably why I usemore
more instead of usingless
more. ( Sorry, that is going to sound a bit of a mess :) )I just tried
less
and couldn't even quit out of it, until I realized it took a vi/vim style command. At least, I believe that is what happened.By in ~ there is always a
.lesshst
file, which Irm
all the time, as I would prefer to usemore
ornano
for simple stuff and I can use TextMate for simple text editing, or Sublime or whatever else I am in the mood for.I also just noticed ".jbapps-myusername" is in ~ now as well. This showed up 2 days ago, and I don't recall installing anything strange. Any idea what it is? I have never jailbroken my phone, and don't install hacks on my machine. Those things that do go into that grey area are getting played with in a VM, not on the core of the machine I am working on as my main computer.
$file .jbapps-haneda .jbapps-haneda: ASCII text, with no line terminators
The contents of the
.jbapps-*
file are "483^@" with no leading or trailing newlines, carriage returns etc.Then there is my git issue. I have a
.config
directory, inside it is a "git" dir, which inside that is a file called "ignore", which as far as I can tell, is near identical to.gitignore_global.
Did git create.config
, or is this a convention that other apps use as well?That brings me to my final issue, in ~ I have .gitignore_global, .gitconfig, and also .config/git/ignore
Seems a mess to me, I would love to
mv .gitignore_global .gitconfig .config/git
Is there a config somewhere that I can define these locations? It's all just a mess of dot files, it would be so much nicer if ~ simply had.config
and all the dot files were in there. I can live with .ssh as it is a directory, so there is at least an effort to not litter my home dir. But raw dot files kind of get in my way. I know I canls -l
and not show the dot files, but I think seeing all your files all the time is a good way to learn what has been created that you might not be aware of.Thank you.
Suggestions?