Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unfortunately, with this approach it only takes one invocation of bash without your .bashrc (or otherwise without HISTFILESIZE=-1) to truncate your history to 500 lines:

    $ man bash
    /HISTFILESIZE
         The  maximum number of lines contained in the history file.
         When this variable is assigned a value, the history file is
         truncated, if necessary, by removing the oldest entries, to
         contain no more than that number  of  lines.   The  default
         value  is  500.  The history file is also truncated to this
         size after writing it when an interactive shell exits.
(I also like that with my approach I also get the timestamp and current direct rate.)


It is for this reason that I also keep my bash history in git. I know other folks that do this too. There have also been solutions on HN in recent months for keeping your shell history in an sqlite database.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: