kill Linux Command
Sends a signal to terminate a process by its PID.
What does kill do?
Sends a signal to terminate a process by its PID.
Syntax
kill [options] PIDPractical example
kill -9 1234Questions about kill
What does kill -9 do?
Sends SIGKILL (signal 9) which immediately terminates the process without allowing cleanup. Use as a last resort when normal termination fails.
What is the difference between kill and kill -9?
Default kill sends SIGTERM (15), allowing graceful shutdown. kill -9 sends SIGKILL which forces immediate termination without cleanup.
How do I kill a process by name?
Use `killall processname` or `pkill processname` instead of `kill`. You can also use `pgrep processname | xargs kill`.
How do I kill all processes of a user?
Use `sudo killall -u username` to kill all processes owned by a specific user. Use with caution.
What signals can I send with kill?
Common signals: 15=SIGTERM (default), 9=SIGKILL, 1=SIGHUP, 2=SIGINT, 20=SIGTSTP. Use `kill -l` to see all signals.
How do I see what signal a process received?
Use `dmesg | grep 'killed process'` to see recently killed processes and the signal that was sent.
How do I send SIGHUP to a process?
Use `kill -1 PID` to send SIGHUP, which typically tells a process to reload its configuration without restarting.
How do I stop a process gracefully?
First try `kill PID` (SIGTERM) to allow the process to clean up. Only use `kill -9 PID` if the process doesn't respond to SIGTERM.
Related Process Commands
htopEnhanced, more user-friendly version of top with color and mouse support.
killallKills all processes matching a given name.
topDisplays an interactive, real-time view of system processes and resource usage.
pkillSends a signal to processes based on name and other attributes.
psReports a snapshot of current running processes with their PIDs.
bgResumes a suspended job in the background.