One thing I come to use quite often is my history. often times I don’t quite recall which switches I used to run a command I may have used yesterday. by typing “history” at the command line I get the past 1000 commands (500 by default on most systems) I ran. while thats a bit much lets say I wanted to recall where I saved the last tar archive I created. a simple “history | grep tar” will show all the lines that contain the word tar.
now for some useful options for how your systems history functions, I kicked my system up to record the last 1000 commands you can adjust this by making some changes to the environment in your personal bash configuration file (~/.bashrc) or in the global bash configuration file (/etc/bash.bashrc).
export HISTCONTROL=ignoreboth export HISTSIZE=1000
the first line will tell bash to ignore lines that match the last command you ran so if you run ps -awfux 3 times in a row (even if its over a couple hours) it will only record a single instance of that command.
the second line defines the size of the history file, in my case I chose to save the past 1000 lines.
Like this post? Tip with bitcoin!
If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.