Quick Tip: Pause any process you want in Linux

 mike@krusty:~$ pidof ffmpeg
 22730
 mike@krusty:~$ sudo kill -STOP 22730
 [sudo] password for mike:
 mike@krusty:~$ sudo kill -CONT 22730

Holy crap, how come it took so long for me to figure out you can pause a running process in Linux and restart it later? I was looking at the manual page for the kill command (man kill) when I started wondering what the CONT option is used for. It turns out that it is paired with the STOP option (and a couple of others) which can be used to pause a running process. Here’s a quick rundown of the process:

  1. Find the PID of the process using the ‘pidof’ command
  2. Pause the process using that PID (22730 for example): sudo kill -STOP 22730
  3. Go about your business
  4. Restart the process when you’re ready: sudo kill -CONT 22730

What can you use this for? Well, if you’re doing something processor intensive, like transcoding video, you might want to regain your CPU power for a quick task. This lets you do that.

essential