What is .history file?

… numerous .history. files and new ones are popping up. Is this normal?

Probably not.

I'm not sure what causes the dregs but as far as I know, there should be just one ~/.history file (no dregs). See for example <https://forums.FreeBSD.org/threads/81237/post-523049>

I recently removed some dregs from my home directory.

Code:
root@mowa219-gjp4-8570p-freebsd:~ # ls -hl /usr/home/grahamperrin/.histor*
-rw-------  1 grahamperrin  grahamperrin    67K Aug 22 04:37 /usr/home/grahamperrin/.history
root@mowa219-gjp4-8570p-freebsd:~ # ls -hl /usr/home/bbsadmin/.histor*
ls: No match.
root@mowa219-gjp4-8570p-freebsd:~ # ls -hl /root/.histor*
-rw-------  1 root  wheel    73K Aug 22 09:48 /root/.history
-rw-------  1 root  wheel    37B Jan  2  2021 /root/.history.16593052
-rw-------  1 root  wheel   656B Feb 11  2021 /root/.history.3126201
root@mowa219-gjp4-8570p-freebsd:~ #
 
I am seeing the same thing. Numerous history files with a number attached.
Example from users home directory:
.history.879329
.history.884368
.history.884856
.history.895317
.history.906169
.history.934475
.history.93622
.history.939921
.history.948512
.history.948584
.history.972109
.history.975053
.history.975309
.history.998851
.history.998894


What I have found is that when I open an Xfce4 Terminal window the history for that goes into a new file.
As seen above.

It is a new mis-behavior for a while now. I don't know if there is a setting or sysctl to funnel them to one history file.
That would be nice... It used to work that way.

There is a way to lose history by logging into the same user twice.
File locking probably blocking one terminals history saves.

I increase users tcsh shell config file to 10000 to keep alot. I find history a great way to write scripts.

set history = 10000
set savehist = (10000 merge)

I have often thought of a .history 'server' so that all my local network .history is collected in central reserve.
 
I have found the opposite. When I had a crashing machine that was shutting down the .history file got wiped out.

My dregs are caused by the xfce4 terminal app. For absolute sure.
I will look at the .config files and investigate.

When I switched to FreeBSD 12 the xfce4 terminal was broke. I had to learn xterm.
A subsequent update fixed the terminal for me.
It was around then that these dregs started occuring. I have 169 dreg .history files right now. How do you merge them?
 
Well for me it was related to xfce/terminal. The dregs are gone.
/.config/xfce/terminal/rcterminal
CommandLoginShell=TRUE

Also found in the Xfce Terminal Menu >>Edit>>Prefrences>> Check "Run Command As Login Shell"
 
Is it possible to have tcsh put the history into a single file? My home directory gets crowded anytime I show hidden files.

I tried the following from here but it still generates more than one file.
 
… have tcsh put the history into a single file? …

Take care to exit or key Control-D.

(Don't simply close terminal tabs/windows, if the terminal application does not do what's required when closing.)

I have just one stray file, which might have been from a crash a few months ago:

Code:
% echo $0
/bin/tcsh
% ls -hl ~/.history*
-rw-------  1 grahamperrin  grahamperrin    69K  4 Apr 12:46 /home/grahamperrin/.history
-rw-------  1 grahamperrin  grahamperrin     0B 29 Nov 07:37 /home/grahamperrin/.history.10857158
%
 
Take care to exit or key Control-D.

(Don't simply close terminal tabs/windows, if the terminal application does not do what's required when closing.)

I have just one stray file, which might have been from a crash a few months ago:

Code:
% echo $0
/bin/tcsh
% ls -hl ~/.history*
-rw-------  1 grahamperrin  grahamperrin    69K  4 Apr 12:46 /home/grahamperrin/.history
-rw-------  1 grahamperrin  grahamperrin     0B 29 Nov 07:37 /home/grahamperrin/.history.10857158
%
I need to take back what I said. It did work, I just had history files from before still.
I didn't want to have to type exit every time I close a terminal, so this is much better. :)
 
Back
Top