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?


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.

  • 3
    This is awesome, thanks. Also, thanks for showing me how to look something like this up in the future.
    – Tom Purl
    Mar 31 '16 at 14:45

This action of "escaping" from the editor into a temporary shell is often referred to as "shell out"

Example: http://www.tldp.org/LDP/gs/node5.html

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.