history
Last updated
[root@localhost ~]# history 10
92 ls
93 cd ..
94 ls
95 exit
96 ls -a
97 cd .ssh/
98 ls
99 cat known_hosts
100 exit
101 history 10[root@localhost ~]# history 3
15 2017-08-26 11:44:35 root history 3
16 2017-08-26 11:44:37 root history n
17 2017-08-26 11:44:40 root history 3[root@localhost ~]# history -chistory -cw
`~/.bash_history`: 保存历史命令
`/etc/profile` -> HISSIZE: 历史命令保存数量
推荐添加 h -> history, hsi -> history|grep 别名
`!n`: 执行第 n 条历史命令
`!xxx`: 执行最后一条 xxx 开头的命令