When I am in bash and press Esc, Shift+K, V, bash fires up $EDITOR with a filename similar to /tmp/bash-fc-186566385.

Why is that and what is its purpose?

I probably need to mention that I am running bash with set -o vi.


2 Answers 2


You don't need Shift + k. Using Esc + v will work since you are allowing shell command line editing using the built-in vi editor using set -o vi (same can be acheieved with Ctrl + x + e). This is equivalent to execute the builtin fc command which is useful to manipulate the history list and history file. It will invoke whatever editor is set in your $EDITOR (otherwise, your shell's default editor) to write a long, tricky or complex command and then execute them after saving and closing the editor. See here for details about fc command: Bash history builtins.


This allows you to construct a command with full Vi editing. If you type some commands in and save exit :wq the commands will be run.

CLARIFICATION: it allows you to construct the command in whatever editor you have set in $EDITOR and when you save and quit from it the contents will be run. (Clarified that it's not just Vi!)

ALSO, as noted by RealSkeptic, the shift+K combination isn't required to bring up the editor. Simply esc, V will.

  • Please note that few keyboards have a key labelled v. Pressing key (or better keys) to get K is normally marked up as <kbd>Shift</kbd>+<kbd>K</kbd> and pressing the key to get (lowercase) v as <kbd>V</kbd>
    – Anthon
    May 1, 2016 at 12:43
  • No but your edit to the OPs post did have incorrect ones.
    – Anthon
    May 1, 2016 at 12:52
  • 2
    Isn't the editor mode reachable simply by escape-V? The "shift-K" there seems to be just voodoo. May 1, 2016 at 12:58
  • @RealSkeptic you are correct, good supplementary information
    – forquare
    May 1, 2016 at 13:01
  • 3
    Also Ctrl-x + e (if you are not in vi mode)
    – Iacchus
    May 1, 2016 at 15:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .