Live data from Hacker News

Shortcuts to Move Faster in Bash Command Line

teohm.github.com

1–10 of 26 posts

Re: Shortcuts to Move Faster in Bash Command Line

#3
This is a description of the Emacs bindings, which are the default. Vi bindings are also available and can be enabled by adding

    set -o vi
to ~/.bashrc.

Peteris Krumins also has an article on bash command line editing with some extra information on completion:

http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-s...

Re: Shortcuts to Move Faster in Bash Command Line

#7
post #3

This is a description of the Emacs bindings, which are the default. Vi bindings are also available and can be enabled by adding set -o vi to ~/.bashrc. Peteris Krumins also has an article on bash command line editing with some extra information on completion: http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-s...

Beat me to it. (My first thought upon seeing the headline was, "wow, faster than vi mode?")

I haven't actually put the set into my .bashrc yet, I just end up typing it when I realize I'm about to navigate a lot.

Re: Shortcuts to Move Faster in Bash Command Line

#9
post #5

What's wrong with using the arrow keys?

It amounts to significantly less hand and finger movement.

Exactly. That's why I'm such a fan of emacs. The closer I stay to the home-row, the better.

Also, 'Ctrl + p' and 'Ctrl + n' will navigate through your command history. I do love 'Ctrl + r' for searching through it, too.

Re: Shortcuts to Move Faster in Bash Command Line

#10
post #8

My favorite tip is to stay in emacs mode, but whenever you have something "complicated" to do, use Ctrl-X Ctrl-E : it opens the current line in $EDITOR.

This is amazing. One of my persistent nuisances had been when and how to transition from command line to script. This makes it smooth!
Post reply on HN