All commands run in Linux are archived in a file and you can see these commands with the history
command when you need it.
The History archive is also stored in a file that you can modify. Bash shell users can find their history in the .bash_history
file in their home directory (cd ~
).
The file where the archive will be kept is kept in the $HISTFILE
variable. If desired, this variable can be edited from the .bash_profile
and printed to a different folder.
export HISTFILE=~/.custom_file
How many rows of archive records will be kept is stored in the $HISTSIZE
and $HISTFILESIZE
variables and the default values ββare 1000.
Below is the variable that must be added to the .bash_profile
in order to print the date and time the commands were run.
export HISTTIMEFORMAT="%d/%m/%y %T - "
To display the entire archive on the screen;
history