history历史记录控制

时间:2023-03-09 18:33:11
history历史记录控制

往往我们操作的每一条命令都会被机器记录下来,所有我们为了安全需要屏蔽掉某些敏感的操作命令。

设置linux默认的历史记录数:

临时生效:

export  HISTSIZE=5

history

history历史记录控制

永久生效:

echo "export HISTSEZE=5" >>/etc/profile

. /etc/profile或者source /etc/profile    //是得配置生效

history历史记录控制

控制历史记录的文件:命令行的历史记录数量变量

cat ~/.bash_history

history历史记录控制

历史记录文件的命令数量变量(~/.bash_history)

临时生效:

export HISTFILESIZE=5

history

永久生效:

echo “HISTFILESIZE=5” >>/etc/profile

. /etc/profile或者source /etc/profile   //是得配置生效

history历史记录控制

清空历史记录:history –c

history历史记录控制

清空指定记录命令:

history –d 行号

history历史记录控制