What is "<Esc>Kv" in bash

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.