history

来源:互联网 发布:王兆山 真相 知乎 编辑:程序博客网 时间:2024/04/29 06:13

history:显示执行过的命令,也可以根据显示的指令来重新执行需要的命令

常用:

[root@redhat ~]# history        #查看所有执行过的命令    1  ls    2  pwd    3  fc -l    4  history [root@redhat ~]# history 2      #显示2条    4  history     5  history 2[root@redhat ~]# !4             #执行编号是4的命令,注意感叹号history     1  ls    2  pwd    3  fc -l    4  history     5  history 2    6  history [root@redhat ~]# history -c    #清除历史记录

参数:

n 显示n个最近的记录-a 添加记录-r 读取记录,但不会添加内容记录-w 覆盖原有的history 文件-c 清除记录-d<编号> 删除指定文件-n<文件> 读取指定文件-r<文件> 读取文件但不记录-w<文件> 覆盖原有文件 

0 0
原创粉丝点击