Killing misbehaving processes
Regarding the ps
command, by this point you know how to display processes running on your server, as well as how to narrow down the output by string or resource usage. But what can you actually do with that knowledge? As much as we hate to admit it, sometimes the processes our server runs fail or misbehave and you need to restart them. If a process refuses to close normally, you may need to kill that process. In this section, we introduce the kill
and killall
commands to serve that purpose.
The kill
command accepts a PID as an option and attempts to close a process gracefully. In a typical workflow where you need to terminate a process that won't do so on its own, you will first use the ps
command to find the PID of ...
Get Mastering Ubuntu Server now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.