Enhancing Skills

killall: Send a signal to all processes matching a given name

Command: killall

The killall command sends a specified signal to all processes matching a given name. By default, killall sends the SIGTERM signal, which requests a graceful shutdown of the processes. It is a powerful tool, especially when you need to terminate multiple instances of the same process.


Sample Commands and Outputs:

  • killall process_name: Sends the default SIGTERM signal to all processes with the specified name. Sample Command and Output:
  $ killall firefox

Description:

  • firefox: The name of the process to terminate. This command will send the SIGTERM signal to all running instances of firefox, requesting them to shut down gracefully.
  • killall -9 process_name: Sends the SIGKILL signal, forcefully terminating all processes with the specified name. Sample Command and Output:
  $ killall -9 firefox

Description:

  • -9: The option to send the SIGKILL signal, which forces an immediate shutdown.
  • firefox: The name of the process to terminate. This command will forcefully kill all running instances of firefox.
  • killall -u username: Sends the SIGTERM signal to all processes owned by the specified user. Sample Command and Output:
  $ killall -u davidq

Description:

  • -u davidq: The option to target all processes owned by the user davidq. This command will send the SIGTERM signal to gracefully shut down all processes started by davidq.
  • killall -v process_name: Provides verbose output, showing which processes were terminated. Sample Command and Output:
  $ killall -v firefox
  Terminated firefox(1234) ...
  Terminated firefox(5678) ...

Description:

  • -v: The option for verbose output, detailing the PIDs of the processes terminated.

Note: The killall command is particularly useful for managing multiple instances of the same process. However, use it with caution, especially with powerful signals like SIGKILL, as it can terminate all matching processes without discrimination, potentially causing data loss or disruption.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.