Linux Cmd Tool 系列之—history & search command history
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Cmd Tool 系列之—history & search command history相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章