#linux Tips: Enable Timestamp in Bash History



#linux Tips: Enable Timestamp in Bash History

#linux Tips: Enable Timestamp in Bash History

In Linux, you are familiar with the history command. It allows you to see which commands you have previously executed.

But there is one problem. The history command does not show when the command was executed by default.

In this quick tip, I’ll show you how to enable timestamps in the history command.

export HISTTIMEFORMAT=”%F %T ” is a command used to set the format of the timestamp that is recorded in the command history. The command sets the timestamp format to be the full date and the full time, separated by a space. This allows the user to see the exact date and time when each command was executed in the command history.

export HISTTIMEFORMAT=”%F %T ”

However, because the changes are only valid for the current session, the history command will revert to its previous state after you log out.

To permanently apply the timestamp, make changes to the ~/.bashrc file.

vi ~/.bashrc

And now, whenever you use the history command, it will display the timestamps with each command.

Subscribe for more Linux tips!!!

PLEASE SUBSCRIBE 🙂
PLEASE HIT LIKE IF IT HELPED 🙂

GIVE SUPPORT – https://www.patreon.com/lazysysad
BUY ME A COFFEE – https://www.buymeacoffee.com/lazysysad
PAYPAL – https://www.paypal.com/donate/?hosted_button_id=K4RQ3LAWHGVS6

Drop me your feedback and comments.

That’s all for now.

If this video helped you in any way, please like share and subscribe!

Thank you!!!

Comments are closed.