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:

       killall5 -- send a signal to all processes.

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

       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.

       -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

2 thoughts 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: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s