Is there a maximum size to the bash history file?
Solution 1
Instead of specifying numbers, you can do
unset HISTSIZE
unset HISTFILESIZE
shopt -s histappend
in which case only your disk size (and your "largest file limit", if your OS or FS has one) is the limit.
However, be aware that this will eventually slow down bash more and more. see this BashFAQ document and the debian-administration article (original link died, look in a mirror: archive.is and archive.org) for techniques which scale better.
Solution 2
You can use logrotate to preserve old entries. It allows you, for example, to set size limits that will trigger archiving. It is normally run from a daily cronjob, but you might just as well invoke it from your .bash_logout
script.
Solution 3
@Philomath, unsetting those environment vars does not work for me at all! For me, this causes bash to use its inbuilt defaults (it seems) of truncating .bash_history to about 9KiB.
What does work for me is the following in my .bashrc:
export HISTSIZE=
export HISTFILESIZE=
shopt -s histappend
Related videos on Youtube
InquilineKea
Quora page: http://www.quora.com/Alex-K-Chen Google+: http://profiles.google.com/simfish Email: simfish+s[at]gmail.com Feel free to stalk my Internet name(s) if you wish - it's how I make most of my closest contacts these days. Just note that I don't really believe in social constructs when they get in the way of satisficing (or in the way of my goal of learning as much as possible). Don't take anything I say/do too seriously. A lot of the things I do (that may look weird/stupid on the outside) are the types of things that help me adjust my posterior probability of various things - especially low probability events.Sometimes I hit on a jackpot/very interesting idea. I'm kind of messy since it helps facilitate creative destruction. I have a lot of respect for all of the sciences. Tactically, I'm developing heuristics for rationality, impartiality, anti-laziness, and creation+identification+searching for what's relevant+reliable. Strategically, I just want to learn everything. A lot of my thought processes involve my creating new hypotheses and refuting them on my own. I still document the thought process since it's important and may be important for future "true" hypotheses.
Updated on September 18, 2022Comments
-
InquilineKea over 1 year
Can I increase the size of the command history in bash?
Note that I use a Red Hat Linux computer in the undergraduate astrophysics department here (so I don't get that many privileges).
-
Prince John Wesley almost 13 years
-
-
clerksx over 12 yearsYou may also have to increase
history-size
in yourinputrc
. -
Balmipour about 7 yearsLooks like the most sustainable approach to me, since removing size limits will, on the long run, have performance impacts. While I'm not sur I'll reach the treshold anytime soon, I'm afraid it would take some time to start noticing such impacts. Btw, consider adding the config you set, and the optionnal bash logout command to add.
-
DrBeco about 7 yearsThe link is down. Maybe edit to point to another link with the same intended info?
-
Chris Povirk over 6 yearsWarning: As noted [unix.stackexchange.com/a/76129/78713](below), this may cause Bash to inherit defaults and, if your existing
.bash_history
is larger than those, to truncate it.