How do I check user command history with TIME / Linux?

时间:2018-03-25 19:57:23

标签: bash centos redhat

How do I check WHEN did a user issue a command? I can see a command being issued in .bash_history , but I'd like to know WHEN it was issued? I'm aware of the export HISTTIMEFORMAT='%F %T command, but that only logs AFTER I've issued the command.

1 个答案:

答案 0 :(得分:0)

在.bash_profile中输入命令

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

在哪里

%d –天
%m –月
%y –年
%T –时间