bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/Bash/System Monitoring
Bash•System Monitoring

Bash kill Command - Terminate Processes

Using the kill Command

The kill command is used to terminate processes in a Unix-like operating system.

It's a powerful tool for managing system resources and ensuring that processes do not consume more resources than necessary.

Common Uses

The kill command is commonly used to:

  • Terminate unresponsive processes.
  • Manage system resources by stopping unnecessary processes.
  • Send specific signals to processes for custom handling.

Syntax

The basic syntax of the kill command is:

kill [OPTION]...
...

Options

The kill command has several options to customize its behavior:

  • -9 : Forcefully terminate a process.
  • -l : List all signal names.
  • -s [signal] : Specify a signal to send.
  • -p : Print the process ID.

Forcefully Terminate a Process

The -9 option sends the SIGKILL signal to a process, which forcefully terminates it. This is useful when a process does not respond to other signals.

Example: Forcefully Kill a Process

kill -9 1234

List All Signal Names

The -l option lists all available signal names. This can help you understand which signals are available for use with the kill command.

Example: List Signal Names

kill -l

Specify a Signal to Send

The -s option allows you to specify a signal to send to a process. This provides flexibility in controlling processes.

Example: Send a Custom Signal

kill -s SIGTERM 1234

Print the Process ID

The -p option prints the process ID of the process you are targeting. This is useful for verifying the process you intend to signal.

Example: Print Process ID

kill -p 1234

Previous

Bash free Command - Display Free and Used Memory

Next

Bash uptime Command - System Runtime

This chapter

Overview
7

Lessons

23m

Read time

1. Bash ps Command - Snapshot of Current Processes2. Bash top Command - Display Linux Tasks3. Bash df Command - File System Disk Space Usage4. Bash du Command - File Space Usage5. Bash free Command - Display Free and Used Memory6. Bash kill Command - Terminate Processes7. Bash uptime Command - System Runtime

On this page

Using the kill CommandCommon UsesOptionsForcefully Terminate a ProcessExample: Forcefully Kill a ProcessList All Signal NamesExample: List Signal NamesSpecify a Signal to SendExample: Send a Custom SignalPrint the Process IDExample: Print Process ID