Domanda

I know you can use the arrow keys to go up and down the command history in bash but I want to know if there is equivalent letter-based shortcut so my hands don't have to travel as far. Any ideas?

Note: I'm aware of Ctrl-R for searching command history.

È stato utile?

Soluzione

In bash most of the emacs key-bindings works as well.

So what you are looking for here is, C-n and C-p

Or, you can do set -o vi and then use the vi key-bindings j & k. In normal mode of course,i.e. do, ESC first.

Altri suggerimenti

One thing about ctrl-R I didn't know was that you can hit it a second/third/... time to scroll back through previous matching commands. I can't believe that all these year I'd been doing history | grep blah instead.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top