You are not logged in.

#1 2017-02-27 06:31:25

kubrick
Member
Registered: 2016-10-07
Posts: 29

Something keeps deleting my bash history

Hi,

I have had this in my bashrc for years:

export HISTSIZE=10000
export HISTFILESIZE=20000
shopt -s histappend
export PROMPT_COMMAND='history -a'

It's always worked fine, until recently. Now the history accumulates as it should during the session and even when I leave bash, but then it gets truncated to 500 lines every time I reboot which is infuriating.

Can anybody point me in the right direction?

Cheers!

Offline

#2 2017-03-02 07:06:43

NoSuck
Member
Registered: 2015-03-04
Posts: 157
Website

Re: Something keeps deleting my bash history

I recommend setting HISTFILE to something other than ~/.bash_history and seeing if the truncating still occurs.

Offline

#3 2017-03-03 08:48:23

adesh
Member
Registered: 2016-10-05
Posts: 167

Re: Something keeps deleting my bash history

Make sure there are no systax errors in your .bashrc and it is being fully parsed.
One day while playing with my bash config I added a function (having syntax errors) at the top of my bashrc, opened a new terminal window, played around and after logout history file had only 500 lines.

So if there is an error before "HIST" lines, HITSIZE variable will default to 500 and "that" will happen.

Offline

#4 2017-03-07 15:59:46

NoSuck
Member
Registered: 2015-03-04
Posts: 157
Website

Re: Something keeps deleting my bash history

Possibly relevant:

bash(1) READLINE: Readline Variables wrote:

history-size (unset)
      Set the maximum number of history entries saved in the history list.  If set to zero, any existing history entries are deleted and no new entries are saved.  If set to a value less than zero, the  number  of  history entries  is not limited.  By default, the number of history entries is set to the value of the HISTSIZE shell variable.  If an attempt is made to set history-size to a non-numeric value, the maximum number of history entries will be set to 500.

Offline

Board footer

Powered by FluxBB