Killing Processes

Sometimes, the processes running on an account get out of hand. They either run for too long, take up too many of our server resources, or locked up and now we can’t even do anything with them. In the Linux Server world, we don’t have CTL-ALT-DEL and Task Manager to help us out here, but don’t worry, there are a two ways to

Using WHM:

If you’ve got access to WHM (cPanel’s back-end), either because you’re a DoOO Admin or you’re a fellow Reclaimer, the process to kill processes is a rather straightforward process. Just log-in to WHM, and in the search bar, look for Process. You should see Process Manager down toward the bottom under System Health.

The Process Manager will most likely be right on the main screen once you log in to WHM as well.

Here, you’ll see a list of intensive processes, and associated information (who’s running them, how much CPU/RAM they’re using, etc). There are two ways to kill a process:

  1. Kill an individual process by hitting the word Kill in the PID column.
  2. You can also kill all processes by a user by finding their username in the drop down menu, and hitting the Kill user’s processes button.

Using the Command Line:

If you’re not an admin with access to WHM, or you just prefer the command line like I do, there’s still an option for you! Just ssh into your account and run ps. This lists the current processes your account is running. The default output is pretty straight forward, but you can expand on its output using a number of options; just check out the man page for ps to get an idea on what you can do with the program.
29%20AM

If you’re running ps as anyone besides the root user, it will only ever show you the processes under your own account. The root user (which is only accessible by admins) can get information on all processes running on the server, regardless of user. Speaking of which, here’s a very useful line that if run as the root user will give a list of the 15 processes using the most RAM and CPU: ps -eo user,uid,pid,pcpu,pmem,start,time,comm,args=PATH | sort -r -k 4,5 | head -n 16

Once you find the PID (or Process ID) of the program you want to kill, just type kill -9 <PID>. There are other options to use with kill (here’s a good list), but -9 is usually the best for getting the job done.
06%20PM

If you have many processes running and need to find a specific one, you can always pipe the output of ps to grep and search for any string of text. Running ps with additional options, such as ps hax will give you additional information that may be helpful in narrowing down the specific process.
28%20PM

There are other options besides stringing together ps, grep, and kill commands to manage your processes via the command line. However these tools may bary depending on your account and what server you are on. One option that every account should have access to is top, which is an interactive command line task manager that, for the most part fills the role of ps, and can be used to search for and kill running processes.
10%20PM

If you’re the root user, you should have access to htop, which although very similar to top, is more powerful, more user friendly, and provides more information. Both top and htop have man pages that can provide a wealth of information on their use.