- !! - refers to the previous command;
- !n - refers to the command number n;
- !-n - refers to the command number of the "current minus n";
- history -c - clear the history by deleting all the records
- history -d n - delete from the history entry number n
- history -a - to append commands entered in the current session bash, at the end of the file $HISTFILE
To display the time and date when any command has been executed, need to set the "HISTTIMEFORMAT".
# show all history commands history # display last 25 commands history 25
And add the line at the end:
run the following command:
export HISTTIMEFORMAT="%h %d %H:%M:%S "
it will reload all the changes that we ordered.
May the Force be with you,