There's no timestamp of each command when we are using 'history ' command to see the command records.
We can add timestamp for each command by following steps:
1. Edit ~/.bashrc or /etc/bashrc
export HISTTIMEFORMAT="%m-%d-%Y %H:%M:%S "
Note: m, d are in lowercase, Y, H, M, S are in uppercase.
There's a blank between 'S' and the last Quote Mark.
2. Save the bashrc file, and use 'source ' command to reload the bashrc config file.
3. Done.
本文指导您如何通过编辑.bashrc文件并设置HISTTIMEFORMAT变量来为历史命令添加时间戳,确保命令记录更加详细易查。
2026

被折叠的 条评论
为什么被折叠?



