history 命令记录加执行时间戳

export HISTTIMEFORMAT="%F %T `whoami`"

Linux history 命令记录加执行时间戳以及记录执行命令到message日志

效果如下:

Linux history 命令记录加执行时间戳以及记录执行命令到message日志

 

记录登陆系统的人指定的命令以及时间,执行命令所在的目录记录到系统message日志

export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; }); logger "[euid=$(whoami)]":$(who am i):[`pwd`]"$msg";}'

Linux history 命令记录加执行时间戳以及记录执行命令到message日志

 

/var/log/message的内容为

Linux history 命令记录加执行时间戳以及记录执行命令到message日志

 

相关文章:

  • 2021-06-18
  • 2022-12-23
  • 2022-01-10
  • 2021-06-23
  • 2021-08-24
  • 2021-06-05
  • 2022-12-23
  • 2021-12-13
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-10-03
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案