killall vs killall5

I learned this the hard way. In Linux, killall kills process by name whereas in Unix System V, killall does what is it is called- kill all processes. killall5 is the SystemV killall command in Linux. If you run killall5 in Linux, it will kill all processes except kernel threads(those surrounded by square bracket in ps aux output) and your login shell.

man killall5:

NAME
       killall5 -- send a signal to all processes.

SYNOPSIS
       killall5 -signalnumber [-o omitpid] [-o omitpid..]

DESCRIPTION
       killall5  is the SystemV killall command. It sends a signal to all processes except kernel threads and the pro-
       cesses in its own session, so it won’t kill the shell that is running the script it was called from.  Its  pri-
       mary (only) use is in the rc scripts found in the /etc/init.d directory.

OPTIONS
       -o omitpid
              Tells killall5 to omit processes with that process id.

I also learned that pidof is a symbolic to killall5 and just behaves differently when invoked as pidof. See man pidof.

    $ ls -l /sbin/pidof
    lrwxrwxrwx 1 root root 8 Nov 14  2015 /sbin/pidof -> killall5
Advertisements

One thought on “killall vs killall5

  1. Pingback: Cannot connect to the Docker daemon. Is the docker daemon running on this host? – rtfmp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s