回到顶部


历史命令

history [选项] [历史命令保存文件]

选项
'-c'
清空历史命令
'-w'
把缓存中的历史命令写入历史命令保存文件~/.bash_history
[root@ssgao1987 ~]# cat .bash_history 
exit
yum -y install yum
yum -y install wget
…

历史命令的调用

*) 使用上,下箭头调用以前的历史命令
*) 使用"!n"重复执行第n条历史命令
*) 使用"!!" 重复执行上一条命令
*) 使用"!字串"重复执行最后一条该字串开头的命令
[root@ssgao1987 ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  shell_01.sh  ssgao
[root@ssgao1987 ~]# !!
ls
anaconda-ks.cfg  install.log  install.log.syslog  shell_01.sh  ssgao
[root@ssgao1987 ~]# !ls
ls
anaconda-ks.cfg  install.log  install.log.syslog  shell_01.sh  ssgao
posted on 2018-04-19 12:42  ssgao  阅读(175)  评论(0编辑  收藏  举报