如何查看命令执行时间?


Answers:


14

您需要设置HISTTIMEFORMATenv变量。

来自help history

If the $HISTTIMEFORMAT variable is set and not null, its value is used
as a format string for strftime(3) to print the time stamp associated
with each displayed history entry.  No time stamps are printed otherwise.

该格式在strftime联机帮助页中进行了描述。

在此处此处查看示例。最有用的可能是

$ export HISTTIMEFORMAT='%F %T '
$ history|tail -2
501  2014-11-03 20:51:41 export HISTTIMEFORMAT='%F %T '
502  2014-11-03 20:51:44 history

2
尝试从链接中添加更多信息。
DisplayName 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.