I copied a large amount of text to the clipboard and then pasted it into the terminal. I didn't realize it would be so large that it would continue filling the screen for ~5 minutes.
ctrl + c
seems to work most of the time but not all the time and I couldn't quite get the timing right it seemed.
How can I stop a runaway/rogue clipboard paste from rendering the terminal useless until it is done?
update: I posted an answer below that uses htop
to find it and then a SIGINT
to kill it but that kills the terminal or pane (tmux) too. Would be nice if it didn't kill/shutdown the process. I tried SIGQUIT
(pause), SIGABRT
(abort) and SIGHUP
(hang up) but no success (it doesn't affect the rogue paste).
update 2: Ahh, in my case it is an HTML paste and ctrl + c
is actually working but since their are line break/returns in the paste it is starting a new paste every second or so. So ctrl + c
is just affecting the current one. I don't think there is going to be an option in this scenario other than to kill the process with a SIGINT
.
https://stackoverflow.com/questions/7771557/how-to-terminate-a-window-in-tmux You can kill specific panes in Tmux, or put the pane in a screen session and kill it that way. I find that a bit excessive, normally I do a ctrl-s to pause the terminal, then ctrl-c. But being lazy I have a keybinding to xkill and just kill the terminal :-) I know its a sledgehammer to crack a wallnut, but if you use vim, you can recover the session from the swapfile by reopening it again.
I ended up launching
htop
, which put my shell (fish) process at the top of the list, at 137% CPU. Then I killed it by pressingF9
(k
also works). I chose the defaultSIGTERM
and it killed the process as expected.