Skip to content

Instantly share code, notes, and snippets.

@DavidMah
Created November 9, 2013 04:29
Show Gist options
  • Save DavidMah/7381692 to your computer and use it in GitHub Desktop.
Save DavidMah/7381692 to your computer and use it in GitHub Desktop.
Programs can often be closed in a few different ways:
1. Sending EOF to standard input. Some program's whole purpose is to only read from standard input, process that data in some way, and output some other information gathered from that input. EOF means End of File. If you are sending information from a file as standard input to a process, then once all of the data in the file is consumed, it will send EOF. If you are typing to the shell to send information to a process's standard input, then you can manually send EOF to the program by hitting CTRL+D.
2. Send SIGINT to a program. Operating systems have these notions of signals. You can send signals to programs, and these programs should have code meant to handle these signals. SIGINT is a signal meant for interrupting a process. Usually, the way a program will handle this type of signal is to just quit. You can send SIGINT to a program through the shell by hitting CTRL+C.
3. Send SIGQUIT to a program. Similar to SIGINT, but conventions dictate that this is a much more rough painful quit, and the programs will do some things that I won't dive into now. Feel free to google/wikipedia. Send this with CTRL+\.
4. Send SIGTERM to a program. That is what the kill program does. Almost the same as SIGINT, it's just a different name for a different sort of situation.
5. Send SIGKILL to a program. Similar to the other signals, except it's not possible for a process to handle it. It just murders the process. Send this with `kill -9`, and you need root user privileges to do this (prepend your command with `sudo ` to temporarily elevate your privileges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment