General Computing
linux bash gnome-terminal
Updated Fri, 20 May 2022 14:20:59 GMT

gnome-terminal/bash: How to cancel inserted commands that will be executed later?

$ execute_some_long_command
<command is executing>
<Accidently press middle button that inserts bunch of garbage (including, for example, `rm -Rf ~/*`) into console>

How to let execute_some_long_command finish, but not execute inserted things?


Type Ctrl+Z (goes back to prompt, doesn't execute keyboard buffer) and then fg to get the running execute_some_long_command back on track.

At least that worked in my Fedora 14 gnome-terminal, testing with sleep 20 as execute_some_long_command and echo blah as the typed garbage.