Four Powerful kill Command Techniques for Managing Linux Processes
This article explains how to use the Linux kill command with SIGTERM, SIGQUIT, SIGKILL, and SIGSTOP signals to gracefully terminate, debug, force‑stop, or pause processes while minimizing data loss and providing practical command examples.
In Linux systems, managing processes is essential for developers and administrators, and when a process hangs, using the kill command with the right signal allows graceful termination and data safety.
1. SIGTERM (15): Graceful termination signal
The default behavior of kill is to send SIGTERM, which asks the process to shut down cleanly, allowing it to perform cleanup. Run the simple command:
kill 123Example output:
bogon:~ sdcui$ jps
73113 Launcher
72522 Main
73114 PdfviewerApplication
72716 RemoteMavenServer36
73118 Jps
bogon:~ sdcui$ kill 731142. SIGQUIT (3): Termination with core dump
SIGQUIT works like SIGTERM but also generates a core dump file that records the process memory state, which is useful for debugging.
kill -3 123Note: Java processes do not exit on SIGQUIT; they only produce a core dump.
Example:
bogon:~ sdcui$ jps
73248 PdfviewerApplication
73259 Jps
72522 Main
72716 RemoteMavenServer36
73247 Launcher
bogon:~ sdcui$ kill -3 732483. SIGKILL (9): Forceful termination
When a process does not respond to SIGTERM or SIGQUIT, SIGKILL is the last resort. It tells the kernel to kill the process immediately, which may cause data loss.
kill -9 1234. SIGSTOP (19) and SIGCONT (18): Pause and resume
SIGSTOP pauses a process without terminating it. You can later resume the process with SIGCONT.
kill -19 123 # pause process
kill -18 123 # resume processSummary
Mastering the four key kill techniques—SIGTERM, SIGQUIT, SIGKILL, and SIGSTOP—enables you to handle stuck processes efficiently while avoiding potential data risks; start with SIGTERM or SIGQUIT and resort to SIGKILL only when absolutely necessary.
Reference: https://man7.org/linux/man-pages/man7/signal.7.html
Cognitive Technology Team
Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.