I recently decided it would be a good idea to start backing up my history, and did so with the following added to
export HISTFILE=~/.history/`date +%Y%m%d`.hist export HISTSIZE=100000
No problem, seems to do what it says it should do.
However I noticed today (after my first log back in to the shell since setting it) that my actual history as recalled by
history (or when grepping for patterns within) itself, was only showing my commands since that log in, it was as if the backup had also erased
When I inspected
.bash_history manually with
less, it was all there as I had expected it should be.
i.e., the output of a
wms_joe@Esau:~$ history | tail 48 past dir 49 ll 50 less .bash_history 51 tail .bash_history 52 cp .bash_history history_backup 53 past usearch 54 less ~/.bashrc 55 history 56 tail history 57 history | tail
tail to .bash_history gives:
wms_joe@Esau:~$ tail .bash_history cd prot_all/ ls find . -type f -name *.txt -print0 | xargs -0 sed -i /XBW1/d find . -type f -name '*.txt' -print0 | xargs -0 sed -i /XBW1/d less PAU_03392_out.txt less ../../PVC_operons/prot_all/PAU_03392_out.txt past cut less PAU_03392_out.txt cut -f3 PAU_03392_out.txt | bc less PAU_03392_out.txt
And these are files etc. I know I was working on recently, and their command IDs should be up in to the 4000-5000 region, not 50 or so.
So my question being, how to I make
history look at the right thing again? Or can I somehow merge the contents of
.bash_history back in to the history so that it is recalled by the command correctly?