• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

killall Command Examples in Linux

by admin

It’s also possible to send signals to multiple processes matching a specified program or username by using the killall command. Here is the syntax:

# killall [-u user] [-signal] name...

To demonstrate, we will start a couple of instances of the sleep program and then terminate them.

$ sleep 500 &
[1] 18801
$ sleep 600 &
[2] 18802
$ killall sleep
[1]-  Terminated              sleep
[2]+  Terminated              sleep

Remember, as with kill, you must have superuser privileges to send signals to processes that do not belong to you.

killall Command Examples

1. To kill all the specified commands:

# killall 

2. To list all known signals:

# killall -l
# killall --list

3. Do not complain if no processes were killed:

# killall -q
# killall --quiet 

4. To send the specified signal instead of SIGTERM:

# killall -s 9 bash
# killall --signal 9 bash 

5. To kill processes owned by particular user:

# killall -u mike 

6. To set to verbose mode:

# killall -v
# killall --verbose 

7. To display the version:

# killall -V
# killall --version 

8. To specify to wait for all the killed processes to die:

# killall -w
# killall --wait 

9. To kill processes with specified security context:

# killall -Z
# killall --context 

10. Interactively ask for confirmation before termination:

# killall -i process_name

11. Terminate a process using the SIGINT (interrupt) signal, which is the same signal sent by pressing `Ctrl + C`:

# killall -INT process_name

12. Force kill a process:

# killall -KILL process_name

Conclusion

Commands often used in conjunction with ps are kill and killall. When running ps, we saw that there is a column that displays PID, short for process ID. If a process isn’t running right, hanging, or we just want to end it, one way is using the kill command. Simply pass it the PID, for example, given a PID of 123:

# kill 123

If you want to match the process by name instead of PID, you can use killall, for example, if Firefox was frozen and we wanted to force quit:

# killall firefox

Filed Under: Linux

Some more articles you might also be interested in …

  1. paccache Command Examples in Linux
  2. protonvpn-cli Command Examples in Linux
  3. firewall-offline-cmd Command Examples in Linux
  4. User Account “systemd-bus-proxy”
  5. 10pt loadable: Metric (TFM) file not found
  6. “yum history” command examples to display, rollback, redo, undo yum transactions
  7. How to modify snmp service to listen to an alternative port in CentOS/RHEL
  8. How to Use Iperf to Test Network Performance in Linux
  9. CentOS / RHEL 6 : How to add/remove additional IP addresses to a network interface
  10. What are the Types of DNS Servers

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright