history历史记录控制

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

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

临时生效:

export  HISTSIZE=5

history

永久生效:

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

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

 

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

cat ~/.bash_history

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

临时生效:

export HISTFILESIZE=5

history

 

永久生效:

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

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

 

清空历史记录:history –c

 

清空指定记录命令:

history –d 行号

 

posted @ 2018-10-26 23:49  南清风  阅读(384)  评论(0)    收藏  举报