1.可以按一下上\下方向键,命令行就会显示相对于当前命令的上一条或下一条历史记录.
2.和方向键相同功能的就是组合键Ctrl+ p (前面执行过的命令),Ctrl +n(后面执行过的命令).
2.上面两个都是相对于当前命令查询上一条或者下一条命令的历史记录.如果搜索命令历史记录,
就用Ctrl+ r 组合键进入历史记录搜寻状态,然后,键盘每按一个字母,当前命令行就会搜索出命令历史记录.
shell > history
34 14-10-28 16:19:24 ll
35 14-10-28 16:19:26 vim test
36 14-10-28 16:19:33 ll
37 14-10-28 16:19:34 ll
shell > !1046
history 3
1045 14-11-02 16:22:38 head ~/.bash_history
1046 14-11-02 16:35:37 history 3
1047 14-11-02 16:35:48 history 3
shell > !!
history 3
1046 14-11-02 16:35:37 history 3
1047 14-11-02 16:35:48 history 3
1048 14-11-02 16:35:52 history 3
shell > !head
head ~/.bash_history
#1414484377
cd update/
#1414484377
shell > head ~/.bash_history
#1414484377
cd update/
#1414484377
ll
#1414484388
vim address
#1414484439
ll
#1414484440
ll
shell >
shell > history 3
1048 14-11-02 16:35:52 history 3
1049 14-11-02 16:36:11 head ~/.bash_history
1050 14-11-02 16:41:05 history 3
(reverse-i-search)`his': head ~/.bash_history