User Tools

Site Tools


history_timeformat

Showing History Time

When running bash command “history”, it regularly excludes the time stamps.

Session Specific TimeStamps

You can set this by running the following command:

HISTTIMEFORMAT=format
For example, the following will set your current session in the specified format:
HISTTIMEFORMAT="%y/%m/%d %T
Running history will now show you time stamps and date stamps:
# history | tail -3
 1055  17/09/16 09:46:23 echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile ; source ~/.bash_profile
 1056  17/09/16 09:46:27 HISTTIMEFORMAT="%d/%m/%y"
 1057  17/09/16 09:46:30 history | tail -3

Permanent Time Stamp

If you wish to set the time stamp permanently then you can run the following command for the user you are logged in as:

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile ; source ~/.bash_profile

history_timeformat.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki