1. Log into your server via SSH: (If you're not sure how to do that, there is a SSH HowTo here)
2. Once you're logged into your server, at the command prompt type:
#top
<enter>
3. Once you see the list of processes that are running on your server, look in the CPU column and see which process is using the highest amount of your CPU.
4. Once you find this process, look all the way to the left of that same line and you'll see a number that is called the PID which stands for "Process ID" (make note of the number). You want to kill this process by following these steps:
While you have top running, hit your k key. By hitting the k key, you will now see: Kill PID 823 with signal [15]:
Example:
Cpu(s): 4.0% user, 1.4% system, 0.0% nice, 94.6% idle
Mem: 1033504k total, 723376k used, 310128k free, 94012k buffers
Swap: 2000084k total, 0k used, 2000084k free, 231276k cached
PID to kill:
Now enter the PID number of the process you want to kill.
<enter>
Type y for yes.
<enter>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another method of killing a process is as follows:
# ps aux | grep name_of_process
At the command line type: kill -9 PID_Number_Here
You can also type:
# killall -9 name_of_process which will kill any process with that name.
<enter>
2. Once you're logged into your server, at the command prompt type:
#ps -auxw
OR #top
<enter>
3. Once you see the list of processes that are running on your server, look in the CPU column and see which process is using the highest amount of your CPU.
4. Once you find this process, look all the way to the left of that same line and you'll see a number that is called the PID which stands for "Process ID" (make note of the number). You want to kill this process by following these steps:
While you have top running, hit your k key. By hitting the k key, you will now see: Kill PID 823 with signal [15]:
Example:
Cpu(s): 4.0% user, 1.4% system, 0.0% nice, 94.6% idle
Mem: 1033504k total, 723376k used, 310128k free, 94012k buffers
Swap: 2000084k total, 0k used, 2000084k free, 231276k cached
PID to kill:
Now enter the PID number of the process you want to kill.
<enter>
Type y for yes.
<enter>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another method of killing a process is as follows:
# ps aux | grep name_of_process
At the command line type: kill -9 PID_Number_Here
You can also type:
# killall -9 name_of_process which will kill any process with that name.
<enter>
The -9 will ensure "execution".
The ps commands discussed so far only list processes that were started from your terminal session
[root@localhost ~]# ps -af
UID PID PPID C STIME TTY TIME CMD
root 2605 2377 0 21:35 tty5 00:00:00 top
root 3140 2663 0 21:53 pts/1 00:00:00 ps -af
The ps program will display all the processes running and their PID
numbers and other information.
To see a long format of the processes in your login session, use:
[root@localhost ~]# ps -l F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 4 S 0 2663 2661 0 75 0 - 1135 wait pts/1 00:00:00 bash 4 R 0 3724 2663 0 78 0 - 1054 - pts/1 00:00:00 ps
[root@localhost ~]# ps ux
killall [process name]
killall -KILL [process name]
killall -SIGKILL [process name]
killall -9 [process name]
kill -s KILL [PID]
kill -KILL [PID]
To display a long format of all the processes in the system, use the following:
[root@localhost ~]# ps -Al
Type the following ps command to display all running process:
[root@localhost ~]# ps aux | less
To see every process on the system :
# ps -A
# ps -e
# ps -e
To See every process except those running as root :
# ps -U root -u root -N
To See process run by user vivek :
# ps -u vivek
The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top
Output:
display a tree of processes
$ pstree
Sample outputs:
ps aux
Now, we use the "grep" command to filter out the process we are looking for. ps aux | grep <process_name>
Replace <process_name> with the name of the process you want to search for. The command above will list all the lines from the output of "ps aux" that contain the string specified with the "grep" command.For example, if you want to find if Apache Web Server is running or not. You'll run the command as follows:
ps aux | grep httpdif the output shows some lines with httpd then that means Apache Web Server (or some process with the name "httpd") is running.