Accidentally sourced .bash_history

bash

In a moment of brilliance, I executed the command source ~/.bash_history. Fortunately, most of the commands are using vim to edit some file, but there are some scary commands in my history – moving and removing files with relative paths.

Fortunately right now it's stuck in a vim session, however if I suspend or quit it, it's on to the next one. The history file is 1000 lines long.

How can I cancel this command, short of rebooting the machine?

Best Answer

If it's a local machine, start a new terminal and kill the shell in question.

If it's a remote machine, ssh in and kill the shell in question.

Related Question