Infinite History. Why?
Have you ever needed to run an a command you executed some time ago only to find out it’s not in your history anymore?
Changing this default behaviour takes a minute. And it’s not like you’re gonna run out of space by saving every single command you ever executed on your shell.
This is a quick guide on how to enable infinite history on your system. Keep in mind your choice of terminal (Default OSX Terminal, iTerm, Terminator, MacTerm…) is irrelevant.
Step By Step
1 - Open up any terminal application (iTerm is my personal preference)
2 - Edit your
.bash_profile. Nano will do
3a - Paste the following 2 lines at the end of the file (which may be empty) and save
3b - In case the above line disables your history, use this instead
(100 Million ought to do it.. Right?)
Accessing the full history
By default, the
history command will show the 500 most recent commands.
You can access the full version of your history by viewing the
Protip - Rerunning Commands
Did you know you can actually run a previously used command by referencing it’s line number in the
You can use
In the example below I rerun command number 6087 which is
echo "hello world by using