Skip to main content

History

The history command in the Linux terminal displays a list of previously executed commands by the current user in the shell. It is useful for referencing commands ran in the past. 

history

Screenshot_2025-06-20_000907.png

You can enhance the history output with timestamps by adding the following to your ~/.bashrc file.

echo 'export HISTTIMEFORMAT="%F %T "' >> ~/.bashrc

Screenshot_2025-06-20_000928.png

Reload the shell, then check history again. 

exec bash

You will see that timestamps are now added. 

Note that all commands ran in history before you modify the bashrc file will all show the same timestamp. This is because time was not capture for those commands before, and it defaults to the current time instead for those commands. 

Screenshot_2025-06-20_000826.png