How to Kill All Python Processes in Ubuntu

Updated July 20, 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.

bibliography-icon icon for annotation tool Cite this Article


About the Author

Kristen Waters has been writing for the computer industry since 2004. She has written training materials for both large and small computer companies as well as how-to and informative articles for many online publications. She holds Bachelor of Science degrees from both York College of Pennsylvania and the University of Maryland.