How to Kill All Python Processes in Ubuntu

Written by kristen waters | 13/05/2017

When you are running multiple instances of Python, it can be difficult to find all of the instances to stop them. In the Ubuntu Linux operating system, each instance of an application or process has a unique ID. You can stop all instances of a particular process, such as Python, without knowing the ID of each process by using the "pkill" command, which locates all of the processes that match the criteria given and kills each one. The "pgrep" command will output the process IDs based on the criteria given.

Right-click on the desktop and choose the "Terminal" option to open a terminal window.

Type the command "sudo pkill python" to kill all of the Python processes running, regardless of the user who started the process.

Type your password when prompted.

Type the command "sudo pgrep python" to ensure that all Python processes have been stopped. There should be no output for this command, and you will not be prompted for a password.


By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.