1. 程式人生 > >linux常用命令 history命令

linux常用命令 history命令

ks.cfg yum shel 重復執行 sta ash 文件 linux常用命令 root

歷史命令

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

linux常用命令 history命令