- Hands-On System Programming with Go
- Alex Guerrieri
- 154字
- 2021-06-24 13:42:16
Killing a job
The foreground process can be terminated with the SIGINT signal using Ctrl + Z. In order to kill a background process, or send any signal to the process, the kill command can be used.
The kill command receives an argument that can be either of the following:
- The signal sent to the process
- The PID or the job number (with a % prefix)
The more notable signals used are as follows:
- SIGINT: Indicates a termination caused by user input and can be sent by kill command with the -2 value
- SIGTERM: Represents a general purpose termination request not generated by a user as well as a default signal for the kill command with a -6 value
- SIGKILL: A termination handled directly by the operating system that kills the process immediately and has a -9 value