Linux pause process

Linux allows you to pause a running process rather than quitting or killing it. Pausing a process just suspends all of its operation so it stops using any of your processor power even while it still resides in memory.

This may be useful when you want to run some sort of a processor intensive task, but don’t wish to completely terminate another process you may have running. Pausing it would free up valuable processing time while you need it, and then continue it afterwards.

To pause a process in Linux we first need to obtain it’s PID, or Process ID number. There are various ways of getting the PID, and here are two. The simplest is the pidof command with the name of the program you wish to pause:

pidof totem

Another way is to use a ps command and search through the results for the program name:

ps aux | grep totem

In this command ps aux lists all of the processes, the pipe sign tells it to filter by the next command (so called piping), and the next command, which is grep totem, searches through the results to display only those mentioning the totem process. The first number in the results should be your PID.

Once you have your process ID you can pause this process by running the kill command with the -STOP option followed by the PID number:

kill -STOP 10463

Of course, the above number is just an example. Replace it with your own. In this example the above command will stop Totem from running.

Totem is a nice example to try out because you can see the immediate effect if you’re playing a movie in it. The movie will stop the moment you run this command. This isn’t the same as pressing the “pause” button in the player controls, because the whole process is completely suspended, not just the playing of a movie. You can see this by trying to press any of the control buttons; they wont respond. The program is frozen, even though you can still move its window.

To continue the process just run the kill command with the -CONT option and your PID:

kill -CONT 10463

If you’ve been playing a movie in Totem, as per this example, your movie would immediately proceed and the button controls in it will work as normal.

And that’s how you pause and continue processes in Linux!