Have you ever needed that command that took you 3 hours of dorking and a couple beers to find, but the thought of how to re-find it left your brain? This may be a total noob thing but when you hit the up arrow on the command line to look through past statements, it's a bit hard to sift through to find the one your looking for. Well I had no idea until I tried looking that those commands are stored somewhere....duh....they r brought up as history so they have to be stored somewhere.
You can find them for user other than root in
/home/myuser/.bash_history
If you are root
/root/.bash_history
Some flavors have the file as just .history, if you have trouble locating it, try
echo $HISTFILE
Just nano or vim that mofo
There are some other commands you can enter to add a date time stamp to your history file along with the command you entered, or even change how many commands are stored in the file. Once the file hits the limit of commands it starts overwriting itself, so hopefully you open it in time.
Hope this helps someone out there.
Here is the link for more information and how to add date/time stamp, etc.
You can find them for user other than root in
/home/myuser/.bash_history
If you are root
/root/.bash_history
Some flavors have the file as just .history, if you have trouble locating it, try
echo $HISTFILE
Just nano or vim that mofo
There are some other commands you can enter to add a date time stamp to your history file along with the command you entered, or even change how many commands are stored in the file. Once the file hits the limit of commands it starts overwriting itself, so hopefully you open it in time.
Hope this helps someone out there.
Here is the link for more information and how to add date/time stamp, etc.
Last edited: