How can I prevent or interrupt accidental copy/paste in the terminal?

To safely paste, you could invoke a text editor in bash using CTRL + X / E. The shell builtin fc will bring up an editor with the last command.

Short of killing the shell/terminal, I am not sure if there is any way to kill something after you have pasted something in, and it has gone wrong.


Using urxvt makes this very easy. Simply enable confirm-paste in your .Xresources.

URxvt.perl-ext-common: confirm-paste,

I think it comes with certain packages of urxvt or urxvt perls... But once enabled it will ask you to hit y or n on paste of primary or selection buffers, and display a line count. So if you see a million lines you can just quickly hit n and be done with it.