Sobes.tech
Middle

How to find and kill a process in Linux?

sobes.tech AI

Answer from AI

To find and kill a process in Linux, you can use the following commands:

  1. Find a process by name:
ps aux | grep process_name
  1. Find a process and get its PID using the pidof command:
pidof process_name
  1. Kill a process by PID:
kill PID

If the process does not terminate, you can use forceful termination:

kill -9 PID
  1. You can also use the pkill command to find and kill a process by name:
pkill process_name

Example:

pkill -9 firefox

This will terminate all processes named firefox.