Categories: How-To

Killall command on Linux (sends signals) [Basic Guide]

The killall command in Linux sends signals to processes and takes as a parameter not the process PID, but its name. It is generally used to terminate the execution of processes that have several processes children performing at the same time.

If no specific signal is passed as a parameter, killall will send the TERM (15) signal to finalize the process in an elegant manner.

In this example, killall forces the web server identified by the httpd name corresponding to processes 1952, 1953, and 1954 to read its configuration file again:

$ ps aux | grep httpd 
wwwrun 1952 0.0 1.7 93232 2248? At 16:15 0:00 /usr/sbin/httpd -f /etc/httpd/httpd.conf
wwwrun 1953 0.0 1.7 93232 2248? At 16:15 0:00 /usr/sbin/httpd -f /etc/httpd/httpd.conf
wwwrun 1954 0.0 1.7 93232 2248? At 16:15 0:00 /usr/sbin/httpd -f /etc/httpd/httpd.conf

# killall —HUP httpd

To abruptly terminate the web service by aborting all httpd processes:

# killall —9 httpd

Difference between kill and killall

It’s important that you understand the difference between the kill and killall commands. The former sends signals to one or more processes identified by the PID. The second sends signals to all processes in the execution queue that have a certain name.

The signals sent by Kill and Killall can be passed by name or by the corresponding integer.

The killall command is very similar to the pgrep command.

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

Did you like it?

Share

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Recent Posts

Sudo command on Linux (privilege scale) [Basic Guide]

The sudo command on Linux executes a given command as if it were another user.…

2 years ago

SS command on Linux (investigate the network) [Basic Guide]

The ss command on Linux is extremely useful for investigating sockets, providing various information about…

2 years ago

Free Linux command (memory usage) [Basic Guide]

Free Linux command shows the amount of total memory in use and available, as well…

2 years ago

Linux while command (loop – while) [Basic Guide]

The shell has structures for testing conditions and executing certain program sequences several times (loop),…

2 years ago

Linux fstab file (disk mount setup) [Basic Guide]

The /etc/fstab file stores the configuration of which devices should be mounted and what is…

2 years ago

Netcat command on Linux (Swiss network knife) [Basic Guide]

The Netcat Command in Linux or nc is a utility used to do “almost anything”…

2 years ago

This website uses cookies.