Search tutorial by keyword

How to use PS, Kill & Nice in Linux to manage processes

 

Processes in Linux have extreme critical importance as every task and application running on your server is a process and sometimes processes stuck and can cause a system crash so to save your server, you have to identify the stuck process and kill the process before it kills your server and prove to be disastrous for you

To check how many process are running on Linux you can use the top command but ps command with combinations can also give you a good picture

#ps aux 

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root         1  0.0  0.2  24188  2120 ?        Ss   14:28   0:00 /sbin/init

root         2  0.0  0.0      0     0 ?        S    14:28   0:00 [kthreadd]

root         3  0.0  0.0      0     0 ?        S    14:28   0:00 [ksoftirqd/0]

root         6  0.0  0.0      0     0 ?        S    14:28   0:00 [migration/0]

root         7  0.0  0.0      0     0 ?        S    14:28   0:00 [watchdog/0]

root         8  0.0  0.0      0     0 ?        S<   14:28   0:00 [cpuset]

root         9  0.0  0.0      0     0 ?        S<   14:28   0:00 [khelper]

lets suppose we want to grep a process in all of these processes 

#ps aux | grep khelper

This will give you only one process khelper

Now we want to kill the process as it’s stuck so we can use following commands to kill it

#kill 9 (9 is the PID of khelper)

#pkill -9 khelper

#killall khelper

All of these commands will kill khelper in their own way

Now if you want to run a program with a certain value use the command nice. High priority processes are less nice and low priority process are nicer as they consume less resources of server

Let’s say I want to run uptime command with priority 5

#nine –n 5 uptime

 

Michael Dudli

Cloud Specialist with more than 10 years experience in the Hosting Business.

Website: www.cloudserver24.com

67275 comments

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Kontakt

Verkauf

sales@cloudserver24.com

Support

support@cloudserver24.com