コマンドの実行時間を確認するには?

コマンドの実行時間を確認するには?

コマンドを実行すると、history最近実行したコマンドのリストが表示されます。これらの特定のコマンドが実行される時期を確認するための規定はありますか?

ベストアンサー1

HISTTIMEFORMAT環境変数を設定する必要があります。

から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

おすすめ記事