This is something that I have often thought would be very handy to have, but was never arsed to go looking to see if it was possible. Well, I was arsed today.
You can easily see which commands you ran in the past. But do you know when did you run it? The history command can tell you that as well.
Source: Enable Timestamp in History Command in Linux
Open the .bashrc
file in your favorite text editor. I am using Nano here.
nano ~/.bashrc
You can use Alt + /
to jump to the end of the file in Nano and add the following line:
export HISTTIMEFORMAT="%F %T "
The main reason I am looking for this is that I want to start documenting my home network (homelab) setup. It is getting more complex and, frankly, I am getting older. Having these timestamps available will only be an asset.