Canceling Processes

There are different reasons to stop a program: it may take too long to finish, your boss may be watching, you may have started the wrong process. There are also diffrent ways to stop processes.

Processes running in the foreground

To free your shell, type the interrupt sequence CTRL-C, which will end the running command.


Unlike some other systems, Unix uses CTRL-C to stop processes in stead of copying selected data to some sort of temporary notepad. Be careful when running sessions to different systems starting from the same graphical environment, e.g. when running a terminal client to connect to an MS windows system.

Canceling one or more processes with kill

The kill command cancels a running process. Use some form of ps to find out the PID of the process you want to cancel and give it as an option to kill.

tille:~>ps | grep mozi   
8943  pts/4  00:00:08 /usr/lib/mozilla/mozilla-bin
8946  pts/4  00:00:00 /usr/lib/mozilla/mozilla-bin
8947  pts/4  00:00:00 /usr/lib/mozilla/mozilla-bin
8948  pts/4  00:00:00 /usr/lib/mozilla/mozilla-bin
8949  pts/4  00:00:00 /usr/lib/mozilla/mozilla-bin
8952  pts/4  00:00:00 grep mozi

tille:~>kill 8943

tille:~>ps -ef | grep mozi
tille     8954  6958  0 11:32 pts/4    00:00:00 grep mozi
[1]+  Terminated              mozilla


Sometimes, a process might not die when the kill command is issued. Try the -9 option to kill in that case.

kill -9 -1 will kill all your processes except your current shell session.

In some cases, a process can loose its parent in such a way that the system can't reach it anymore. In that case, kill won't help. The orphaned process becomes a zombie, occupying resources without being able to use them. On some systems, the only way to get rid of them is to reboot when they start influencing system capacity, on some other systems there's a regular self-cleaning to get rid of excessive entities.