Copied to clipboard

kill

The kill command is used to send signals to processes, which can terminate the process or perform other operations.

Example

  • Terminate a process: kill <pid> (where <pid> is the ID of the process to be terminated)
  • Terminate a process gracefully: kill -s TERM <pid> (where <pid> is the ID of the process to be terminated)
  • Forcefully terminate a process: kill -s KILL <pid> (where <pid> is the ID of the process to be terminated)
  • View the process on a port and terminate it:
    1. View the process on a port: lsof -i :<port> (where <port> is the port number to be viewed)
    2. End the process: kill <pid> (where <pid> is the ID of the process to be terminated)