Linux for Developers Course
Linux for Developers
/
Beginner

kill

Definition

A command used to send a signal to a process, usually to terminate it. It requires the precise Process ID (PID).

Explain Like I'm New

The sniper rifle. You give it the exact ID number of a misbehaving app, and it shoots it down.

Real World Example

A Node app crashes and leaves a ghost process holding Port 3000 open. You find the PID is 405. You type `kill 405`. The OS politely asks the process to shut down.

Common Use Cases

  • •Terminating frozen applications
  • •Freeing up locked network ports

Crucial Command Flags

Flag / OptionDescription
-9SIGKILL. Forcefully kill the process immediately.
-15SIGTERM. Gracefully ask the process to terminate (default).
-lList all available signal names.

Interview Questions

basic

  • If a process refuses to close when you use the `kill` command, what flag do you add to forcefully murder it?

intermediate

  • Does the `kill` command actually 'kill' things, or does it do something else?

Flash Cards

Question

How to force kill?

Click to reveal answer
Answer

Use the `-9` flag (SIGKILL): `kill -9 405`.

Question

What does it actually do?

Click to reveal answer
Answer

It sends a 'Signal' to a process. By default, it sends SIGTERM (Signal 15: please terminate gracefully). You can use it to send other signals, like SIGSTOP (pause the process without killing it).