fbpx Kill Command in Linux: End Processes with SIGTERM and SIGKILL | Certificação Linux

Kill Command in Linux: How to End Processes with SIGTERM and SIGKILL

📅 01/01/2019 ⏱ 2 min ✍️ Uira Ribeiro
Linuxcommands
Kill Command in Linux: How to End Processes with SIGTERM and SIGKILL
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The kill command in Linux sends signals to processes.

It is generally used to terminate the execution of processes identified by their PID.

If no specific signal is passed as a parameter, kill will send the SIGTERM (15) signal to terminate the process gracefully.

In this example, kill forces the web server identified by PID 1953 to re-read its configuration file:

$ ps aux | grep httpdwwwrun 1952 0.0 1.7 93232 2248 ?	S	16:15	0:00 /usr/sbin/httpd -f /etc/httpd/httpd.confwwwrun 1953 0.0 1.7 93232 2248 ?	S	16:15	0:00 /usr/sbin/httpd -f /etc/httpd/httpd.confwwwrun 1954 0.0 1.7 93232 2248 ?	S	16:15	0:00 /usr/sbin/httpd -f /etc/httpd/httpd.conf
# kill –HUP 1953

Abruptly terminates the web service processes with PIDs 1953 and 1954:

# kill –9 1953 1954

The -l option of kill provides a list of signals and their respective codes:

$ kill -l
 1) SIGHUP    2) SIGINT   3) SIGQUIT  4) SIGILL   5) SIGTRAP
 6) SIGABRT   7) SIGBUS   8) SIGFPE   9) SIGKILL 10) SIGUSR1
11) SIGSEGV  12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
( ... )

A command that makes it easier to send signals to processes that have multiple child processes is killall.

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.

Liked it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp