Bash History Contd. You can load an old bash history!
Anders Hornor
Posted on December 4, 2019
It's True You can load an old bash History!
See Last Weeks Post For More on Bash History
So this could be easily adapted into a script that should in essence move through your entire History and add each old history to a new super long history. But anyway here's how to load an old bash history.
So first off as opposed to last time when we were working with the .bash_profile
file this time were working with the .bashrc
file.
.bashrc.
So a little aside about this cool file. The .bashrc
file is a file your terminal runs before it opens. Due to this fact you can add commands to it that the terminal will run as it opens. So this would be a kind of a hacky way to do this and I know there are more elegant ways to due this. I need to explore bash commands more in general mean shit theres probably a way to do this with straight up bash commands any way. This cooooool .bashrc
file can run commands as you open the file. Now that I think of it. I could probably write a command in my .bash_profile
that does this...
Anyway .bashrc
runs commands as the terminal opens so there's definitely a little loop in there that would make a super history. Set the HISTFILESIZE and HISTSIZE to super large and then loop throught all the .bash_session/....historynew
files and history -a
them all. Followed up by a history -r
and voila super file throuretically.
Opening A Specific History file.
- type-
nano ~/.bash_profile
-into your terminal - In your
.bash_profile
file at the very top enter this code
HISTFILE=<history file you want to open thats probable bash_session/.../<somenumbers>.historynew`
reload your terminal
- Voila -
Old History!
Till Next week Adventureres!!!!
Posted on December 4, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024