Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One of my favorite tricks in Bash is when I open my command prompt in a text editor. I do this (in vi mode) by pressing ESC v. When I do this, whatever is in my command prompt is now displayed in my $EDITOR of choice. I can then edit the command as if it were a document, and when I save and exit everything in that temp file is executed.

I'm surprised that none of my friends have heard of this tip, so I've been looking for docs I can share. The problem is that I haven't been able to find anything on it. Also, the search terms related to this tip are very common, so that doesn't help when Googling for the docs.

Does anyone know what this technique is called so I can actually look it up?

share|improve this question
up vote 12 down vote accepted

In bind -p listing, I can see the command is called edit-and-execute-command, and is bound to C-xC-e in the emacs mode.

share|improve this answer
1  
This is awesome, thanks. Also, thanks for showing me how to look something like this up in the future. – Tom Purl 17 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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