码迷,mamicode.com
首页 > 系统相关 > 详细

Linux Cmd Tool 系列之—history & search command history

时间:2016-10-04 01:26:18      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

History cmd is for list Bash‘s log of the historical cmd you typed

1. List last n commands

history n

2. Execute cmd No.n

!n

3. Execute last cmd

!!

or

!-1

4. Execute command n times before

!-n

5. Execute the last cmd that starts with "string"

!string

6. Execture the last cmd that contains "string"

!?string?

7. Execute the "commandName" with any args you used on your last cmd

commandName !*

Search Command History 

Use Ctrl-R then type the command name you used last time, you will see a console window like: 

(reverse−i−search)`:
  • Use Ctrl-R key combination to scroll backword through the history
  • Use Ctrl-R repeatedly to find every string you entered
  • Execute it after finding by [Enter]
  • Right or Left arrow keys to place the cmd on actual bash console

Linux Cmd Tool 系列之—history & search command history

标签:

原文地址:http://www.cnblogs.com/moong/p/5929811.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!