Kill (force end) a program in Windows Terminal
On Linux or macOS one can kill (force end) a program in Terminal by program name using the pkill command. Windows users can similarly kill a program in Windows Terminal by program name using the taskkill command. For example, suppose that Notepad is so locked up that even using Task Manager to end the program doesn’t work - or a non-GUI way of killing a program is desired. From Windows Terminal force end a program by name like:
taskkill /IM notepad.exeSimilar to “pkill” that sends SIGTERM by default on Unix-like systems, the taskkill command above sends a request to the program to terminate gracefully. If the program does not respond, the “/F” option of “taskkill” can be used to force end a program:
taskkill /F /IM notepad.exeThis is similar to a Unix-like system SIGKILL “-9” signal, which can be sent to a program using the “pkill” command like:
pkill -9 notepad