You can see the process IDs for any of your currently running programs with the command:
/bin/ps -u username
% /bin/ps -u someuser PID TTY TIME CMD 28103 tty4a 0:00 matlab 28124 tty5c 0:00 ps 27545 tty5c 0:00 bash
Using the process ID (PID), send the program a termination (SIGTERM) signal, telling it to exit:
kill pid
Here is a full sample session, showing the prompts, commands, and responses.
% /bin/ps -u someuser <-- Look at all processes I am running PID TTY TIME CMD 28103 tty4a 0:00 matlab <-- Defunct process running on another terminal 28124 tty5c 0:00 ps 27545 tty5c 0:00 bash % kill 28103 <-- Send the program a SIGTERM signal % ps -u someuser <-- Check to make sure it worked PID TTY TIME CMD 28125 tty5c 0:00 ps 27545 tty5c 0:00 bash
If the kill command does not kill the process, try kill -9 pid instead and check the process list again. kill -9 will send a SIGKILL signal, which is a more aggressive command to quit the program.