2

In bash , we can move back or forward by 1 word or character. Is there any option where i can move the cursor to the previous character that i specify, for example Forward Slash. ? Something like the f key stroke in vim which searches for the previous occurence of the following character?

5

In Bash's emacs mode:

character-search (C-])

A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences.

character-search-backward (M-C-])

A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences.

I'd recommend you use the vi mode and f works just like in the vi editor. You'll find it's very convenient for command line editing.

To switch between vi and emacs mode, use set -o vi or set -o emacs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.