What the user what the current command execution time
① Scripting
to create scripts
vim displayHisoperTime.sh
Add the script reads as follows:
if ! grep HISTTIMEFORMAT /etc/bashrc; then
echo 'export HISTTIMEFORMAT="%F %T `whoami` "' >> /etc/bashrc
fi
Save and exit:wq
② run the script
chmod u+x displayHisoperTime.sh
./displayHisoperTime.sh
或者
bash displayHisoperTime.sh
③ script Description of content
#export HISTTIMEFORMAT 将此变量输出到环境变量中
#%F %T 日期时间格式
#whoami 当前用户
export HISTTIMEFORMAT="%F %T `whoami` "
history
Before
after: