This is an expansion of knittl's answer that stores the line in the console history by prefixing with a hash. Overcoming drawbacks of the clipboard, such as accidental overwriting or being unable to view the cut line for reference.
Comment Line & Return New Prompt
Use either key shortcut:
A hash character #
will be prepended to the line, thus turning the whole line into a comment. It will also return a new prompt, as if enter was pressed by the user. e.g.
$ #rm -rf /foo/bar/really/long/path/here
$
Retrieve Commented Line
To recover the old line from console history use one of the following shortcuts:
Repeat key shortcut until the desired line appears.
Quick Hash Prefix Removal
To remove the line's hash #
prefix there are a few different options available:
Remove first character and immediately execute command:
Move cursor to start and remove first character, without executing the command:
- Home, Delete
- Ctrl+a, Ctrl+d