Linux 目录已移动

Linux 目录已移动

在 Linux 系统中,使用 mv 命令移动了一个目录,对于这样的操作应该查看哪些日志?在 root bash_history 中我可以看到使用了该命令,不幸的是 bash_history 没有记录时间和日期,因此很难追踪。

谨此致以问候和感谢。

答案1

Vlad,根据经验(除非您启用了系统审计,但大多数管理员都会避免启用,因为它会产生巨大的开销),文件活动实际上并未记录在 Linux 中。为了使您的 .bash_history 对未来事件更有用,您可能需要将以下几行添加到 .bashrc 中:

# append to the history file, don't overwrite it
shopt -s histappend
# write out each command, useful if you have many sessions/shells open at the same time, or run the risk of having an unclean session termination
export PROMPT_COMMAND='history -a'
# 'normal' history stuff
export HISTFILESIZE=8000
export HISTSIZE=6000
export HISTTIMEFORMAT="%F %T%n"

相关内容