学习老男孩Linux的笔记总结20【第82课】82-不断补充history用法的笔记

知识点一:基本应用

history:打印用户操作的历史记录

[root@localhost ~]# history

知识点二:参数

-c:清除之前的所有历史记录

-d 数字:指定要删除的那一行

[root@localhost ~]# HISTSIZE=5 (修改历史记录的个数)
[root@localhost ~]# history
  296  source /etc/profile
  297  echo $TMOUT
  298  history
  299  HISTSIZE=5
  300  history
[root@localhost ~]# export HISTSIZE=5     (相对来说这是比较标准的方法)
[root@localhost ~]# history
  298  history
  299  HISTSIZE=5
  300  history
  301  export HISTSIZE=5
  302  history
[root@localhost ~]# history -c     (-c清除之前的所有历史记录)
[root@localhost ~]# history
  299  history

[root@localhost etc]# history -d 157    (-d 数字,指定删除哪一行历史记录)

 知识点三:/.bash_history

这个文件记录着history的历史记录

[root@localhost etc]# cat ~/.bash_history

[root@localhost etc]# HISTFILESIZE=100      (可以改变文件保存历史记录的大小)

■小总结

TMOUT=10:连接的超时时间控制变量

HISTSIZE=5:命令行的历史记录数量变量

HISTFILESIZE=10:历史记录文件的命令数量变量(~/.bash_history

posted on 2019-05-23 15:54  Erica程  阅读(78)  评论(0)    收藏  举报

导航