Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to define an unlimited history in Bash ?

share|improve this question

migrated from stackoverflow.com May 4 '10 at 12:06

4 Answers

up vote 15 down vote accepted

put that into .bashrc:

export HISTFILESIZE=
export HISTSIZE=

There you go, unlimited history. Currently I have 27000 entries :)

From "man bash":

 If HIST‐FILESIZE is not set, no truncation is performed.

That means .bash_history is never truncated

Also the same seems to apply to HISTSIZE, although I couldnt find that documented.

Another neat feature I'm going to try is this:

If the HISTTIMEFORMAT variable is set, time stamps are written to the history file, marked with the history comment character, so they may be preserved across shell sessions.

Let me know if you have tried that already...

share|improve this answer

Have you googled it?

Go into your .bash_profile now and add these lines

HISTFILESIZE=1000000000

HISTSIZE=1000000

Linux Tips: take control of your bash_history

share|improve this answer
24  
It should be noted that 1000000000 is only equal to infinity for very small values of infinity. – sepp2k May 4 '10 at 12:06
3  
I've upvoted this answer but I think the only way to have truly unlimited history in bash is to modify the source, compile your own copy and buy unlimited disk space. – Doug Harris May 4 '10 at 13:52
+1 to Doug Harris for unlimited disk space; a truly unlimited system will take up all disk space. – Kevin M May 5 '10 at 3:50
1  
Just for the record: "Google" is never a valid response to a question in any way: meta.stackoverflow.com/questions/8724/… – Bobby May 6 '10 at 10:14
Use carefully. Your history file may grow to thousands of kilobytes. – Joey Adams Nov 18 '12 at 1:06

A different concept (may not be applicable) but you can have unlimited history when using shell-sink.

share|improve this answer

Yeah I don't think there is any way to have an 'unlimited' history, but doing as aioobe says should do the trick (although you may put it in .bashrc, either way would be fine) then simply restart bash or do source ~/.bashrc and check with set | grep HIST

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.