Linux history命令
2019-10-20 本文已影响0人
我是付大善人
history命令可以查看执行过的历史命令
命令格式:
[root@shell ~]# history [-n]
[root@shell ~]# history [-c]
[root@shell ~]# history [-raw] historyfiles
-
n
:数字,列出最近执行的n个指令 -
-n
:数字,列出最近执行的n个指令 - 注:网上有资料说显示最近n条命令用的命令为
history n
, 我在自己电脑上试了下为history -n
历史指令可以结合以下指令配合:
-
!number
:执行第number个指令 -
!command
:由最近的指令向前搜寻指令串开头为command的指令,并执行 -
!!
:执行上一个指令