To kill a process in Ubuntu, find the process ID, send SIGTERM first, then verify that it exited. Use SIGKILL only when the process will not respond, and stop a systemd service with systemctl instead of killing a worker that the service manager will restart.
Choose the right way to stop the process
A desktop app, an ordinary command, and a managed service do not have the same exit path. Start with the smallest action that matches what owns the process.
| Situation | Use | Why |
|---|---|---|
| You know the PID | kill PID | Sends SIGTERM by default |
| You know a precise name | pkill -x name | Targets an exact process name |
| You need every matching program | killall name | Stops matching process names |
| systemd runs it | sudo systemctl stop unit | Stops the managed unit |
Find the process before you stop it
Use inspect processes with ps to inspect the command line and PID before you act, especially when several similar processes are running.
ps -ef | grep process-name
pgrep -a process-name
The pgrep command prints matching process IDs and the command line. Check the result before reusing a PID because a process can exit and a later process can receive that number.
Send SIGTERM first
The Linux kill command reference sends a signal to one PID. With no signal option, kill sends SIGTERM, which lets an application handle shutdown and release resources.
kill PID
kill -TERM PID
A disposable sleep process received SIGTERM and wait returned after termination. You can practice this signal flow without touching a working program.
Escalate only when the process will not exit
SIGKILL ends a process immediately. It cannot be handled, so open files and cleanup code do not get a final turn.
kill -KILL PID
Read Linux signals if you need the signal boundary. SIGKILL is appropriate for a stuck process, not as the default form of shutdown.
Stop a process by name with care
When a name uniquely identifies the program you intend to stop, pkill and killall save a PID lookup. Use -x with pkill to avoid matching a longer command name.
pkill -x process-name
killall process-name
The killall command covers name matching in more detail. Both commands can affect more than one process, so confirm the name with pgrep first.
Use systemctl for services
A managed service can return after you kill one of its processes because systemd supervises the unit. Use manage a service with systemctl when the process belongs to a service.
sudo systemctl status service-name
sudo systemctl stop service-name
If the unit is not a systemd service, the service manager or container runtime that started it is the place to stop it. A PID is a process identifier, not proof of ownership.
Use System Monitor when you need a visual check
Open System Monitor, select the process, and choose End or Kill. End requests a normal exit, while Kill forces the process to stop. The existing screenshots below show the menus and process actions.

Use the process name, PID, and resource columns to confirm your target before choosing an action.

Choose End when the application can respond, and reserve Kill for a process that cannot respond before you check whether a service manager started a replacement.
Verify the process is gone
Run a lookup again after any stop command. If it remains, confirm that you targeted the right PID, then inspect whether systemd or another supervisor restarted it.
- Run pgrep -a process-name again.
- Check sudo systemctl status service-name for managed services.
- Inspect logs or the command line before sending SIGKILL.
For broader context, Linux job control connects foreground and background work to the process list. The safe rule is simple: identify ownership, request a normal exit, verify, then escalate only when the process refuses to stop.
What signal does kill send by default?
kill PID sends SIGTERM by default. It asks the process to exit, which gives it a chance to close files and clean up.
When should I use SIGKILL?
Use SIGKILL only after SIGTERM has not worked and you accept that the process cannot clean up. SIGKILL cannot be caught or ignored.
Why does a service return after I kill its PID?
A service manager can restart a process after it exits. Stop the unit with sudo systemctl stop service-name when systemd owns it.
