/ factorpad.com / tech / linux-essentials / kill-command.html
An ad-free and cookie-free website.
Intermediate
Learn to stop processes gracefully at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux kill Command Summary with Examples (3:46)
Our fifty-ninth word, or command to memorize is
kill
from our category
System.
kill
allows you to send a signal to a
process.
-options | description |
---|---|
-l ,
-L |
List signal types by name or number |
-s ,
--signal SIGNAL |
Send SIGNAL to the process |
Recall from video 45, we used the
ps
command to view currently running
processes. Here we'll learn how to use
kill
to, how do I say it, end a
process.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The kill
command has
5 options and the argument is the process id (PID).
Unlike most commands, help is not available with double-dash
--help
as
kill
is a shell built-in (builtin)
on many Linux distributions. So instead try pointing to the
program at /bin/kill
with a
--help
or
-h
option.
The options are basically the type of signal to send. View signal
types using -l
for names,
-L
for number, and once you select the
signal, use -s
and the number or
name.
So why is kill
an important command?
Well, for troubleshooting and general system sluggishness at times
you have to intervene.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Let's start by reviewing the different types of signals
sent to processes, here with
/bin/kill -L
.
The default is 15 TERM
and for really
misbehaving processes we have a number
9 KILL
, and others to review later.
Next, use ps -a
to see our processes.
Here's a sleep from video 43 and we don't need this any longer.
And last, at FactorPad, we don't condone killing anything, so instead
we'll send a politely phrased command
15 TERM
to the process id (PID)
387
.
And ps -a
again to verify.
Very good. (Oh, btw, we dressed our Terminal in black on the video for Halloween. Boo!)
Okay now you know how to use kill
.
And you know the syntax for commands, options and arguments.
One last tip about the kill
command. So please check out the man
page for the command called signal
for an overview on signals.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the kill
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
For more dark humor, check out our YouTube Channel. Get reminders at @factorpad on Twitter or on our no-spam email list.
history
command,
hit Back.bg
, click Next./ factorpad.com / tech / linux-essentials / kill-command.html
A newly-updated free resource. Connect and refer a friend today.