history历史命令

history 历史命令

保存历史命令的文件 ~/.bash_history

管理/调用曾经执行过的命令:
history:查看历史命令列表
history -c:清空历史命令
history -w : 把缓存中的命令写入历史命令保存文件~/.bash_history
!n:执行命令历史中的第n条命令
!str:执行最近一次以str开头的历史命令

调整历史命令的数量:
vim /etc/profile
HISTSIZE=1000 #默认记录1000条

history -c
cat /etc/redhat-release
uname -r
ifconfig | head -2
history

!cat #执行历史命令最近一条以cat开头的命令
!u
history : 打印历史命令

猜你喜欢

转载自www.cnblogs.com/summer2/p/10787829.html