0

In bash we can prepend a command with # and insert the non-executed command into our history. Is there a way to achieve similar behavior through some shortcuts or keybinds?

Kahn
  • 1,702
  • 2
  • 20
  • 39

1 Answers1

2

In vi (set -o vi) mode, you can hit ESC and then #; that will prepend the current command with # and enter it -- harmlessly into the shell as a commented command and also into the command history.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255