Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH

Bash kill Command

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


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.