How to Kill All Python Processes in Ubuntu

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.

Running multiple instances of Python makes finding each individual instance difficult if you want to stop them. In Ubuntu Linux, 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 the processes that match your criteria and kills each one. The "pgrep" command outputs the process IDs based on the criteria given.


Step 1

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

Video of the Day

Step 2

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


Step 3

Type the command sudo pgrep python to ensure all Python processes have stopped. This command should not produce an output, and you will not be prompted for a password.




references & resources

Report an Issue

screenshot of the current page

Screenshot loading...