Find and Terminate Processes from the Linux or Mac OS Command Line

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

This Quick Answer explores some ways to locate and terminate a process from the command line. While there are graphical utilities such as Activity Monitor on Mac OS or Task Manager on Windows, such programs compromise control over processes in exchange for convenience. The command line offers many options for closing a process.

Find Process ID (PID)

A common pattern for ending a process is though its Process ID (PID). There are a variety of ways to find the PID.

If the process name is known, pgrep will search currently running processes for the name:

pgrep firefox
Note

pgrep is not installed by default on MacOS. This can be installed along with pkill and pfind with Homebrew via:

brew install proctools

Another way to list running processes for all users is through ps aux. The output can be piped to grep in order to search for a process:

ps aux | grep firefox

Terminate the Process with kill or killall

Once the PID is found, send the kill signal with kill. Replace the [PID] in this example with the PID found in the previous steps:

kill [PID]

There may be cases where there are multiple instances of the same program running or processes being continuously spawned. In such cases, killall is an option:

killall [process name]

For a more information on kill and killall, see our guide on how to Use Killall and Kill Commands to Stop Processes on Linux .

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.