By default, command history is stored in ~/.bash_history file.
I want to save the history for a specific command elsewhere than ~/.bash_history every time the command is called, like in a file ~/.specific-command-history.
I don't want to run grep to search for a specific command neither exclude it from ~/.bash_history, I just wanted to have a history for a specific command to be automatically stored in other file as well as in ~/.bash_history.
Any thoughts about that?
You could create and run an
anacronscript, even if at a set time the server was switched off, when the server is switched on,anacronwill run the script.The
anacronscript wouldgrepthe file with the command you are looking for, and then usecut, and then append the file you would like to paste the lines into.