« Back to Processes: Frequently Asked Questions

How to kill a running process by its name

To find running processes by their name and stop it, use the killall or pkill command.

Examples using killall

The killall command has the --interactive option that will ask a confirmation before stopping processes.

# killall -i nginx
Kill nginx(51055) ? (y/N) n
Kill nginx(60297) ? (y/N) n
Kill nginx(60298) ? (y/N) n
nginx: no process found

As we answered ’n’ to all questions, killall won’t stop any running processes.

Examples using pkill

pkill nginx

When using pkill, there is no interactive confirmation. Use the pgrep command with the -l option to confirm the right processes are targeted.

Relevant FAQ: How to show a running process name and its process ID (PID)?

Process signals

Most of the tools that can send a signal to a process or a group of processes, can be instructed to send a specific process signal. This might be useful when a process is stuck and does not respond to the default SIGTERM signal.

Relevant commands in this article

Like to learn more about the commands that were used in this article? Have a look, for some there is also a cheat sheet available.

  • killall
  • pkill

Other questions related to Processes


Is the described answer not working or incorrect, got another tip or question? Share your thoughts!