Signals
A signal is a notification that you send to a program. It's up to the program to understand what to do with that. It's like if your friend sent you a text message that said "come over." You (the program) are not obligated to do anything but the intent of the text is obvious, they (the user) want you to come over. The same applies here to programs. The good news is that generally everyone abides what's expected: if you send them a message to quit, they quit.
- List of All Signal Commands.
kill -l
SIGINT
CTRL + C
while a program is running, you're telling it to interrupt what it's doing and stop.- e.g type
yes
on the terminal andhit enter
after that if you interrupt they stop it.
SIGQUIT
- If you're in a bash prompt and it want it to exit.
CTRL + D
it'll tell the bash session to end. You also could close the window or just typeexit
and it'll exit too.- e.g Same as if you write in the terminal "python3" and hit enter the SIGINT not working, So For closing CTRL + D
SIGKILL
If you want a program to stop and stop now, you can do kill -9
(or kill -SIGKILL
) and it will send.
- The
SIGKILL
which means to the program "don't clean up, just stop as soon as possible. - List of all the yes process
- e.g
ps aux
- You can see the id of the process the just type on terminal for
kill -id
, they kill the process
kill -9