#linux

Published: 26 January 2023
on channel: The Lazy SysAdmin
2,339
157

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 -   / lazysysad  
BUY ME A COFFEE - https://www.buymeacoffee.com/lazysysad
PAYPAL - https://www.paypal.com/donate/?hosted...

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!!!


Watch video #linux online without registration, duration hours minute second in high quality. This video was added by user The Lazy SysAdmin 26 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,339 once and liked it 157 people.