[unix] Proper way to exit command line program?

I'm using mac/linux and I know that ctrl-z stops the currently running command in terminal, but I frequently see the process is still running when i check the system monitor. What is the right way to stop a command in terminal?

Typically I run into this issue when running python or ruby apps, i'm not sure if that has something to do with it, just thought I would add that.

This question is related to unix terminal

The answer is


Take a look at Job Control on UNIX systems

If you don't have control of your shell, simply hitting ctrl + C should stop the process. If that doesn't work, you can try ctrl + Z and using the jobs and kill -9 %<job #> to kill it. The '-9' is a type of signal. You can man kill to see a list of signals.


if you do ctrl-z and then type exit it will close background applications.

Ctrl+Q is another good way to kill the application.