How To Monitor / Manage Processes In Linux System | ps,top, nice, renice

process monitoring commands in Linux
 
Below are some important commands which can be used to check the processes in Linux  system.

1: PS command : ps stand for processes in Linux. you can use this command with various options to check the processes running in the system & manage them. Below are some common use of ps command.

a) If you run only 'ps' command it will show only current executed process by you.



b) If  you want to check every single process running  under the system 
 
$'ps -e'

how to use ps command in Linux to monitor processes



You can use 'ps -ef , ps -eF , ps -ely' options to get detailed information about all processes.


how to monitor system in Linux with PS commands
 
c) If you want to check all running process in  hierarchy format. 
 
$ ps -ejH or ps -axjf


how to use ps command in Linux to monitor processes



d) If you want to check process with their exact path location . 
 
$ 'ps -eLf' 


how to use ps command in Linux to monitor processes

e) To see every process running as root in user format , run command

$ ps -U root -u root u


how to use ps command in Linux to monitor processes




how to use ps command in Linux to monitor processes

f) To see every process as user defined options. 

$ ps eo pid, tid, class, rtprio, ni, pri, pcpu, stat, comm

put options given with command to see related output.


ps commands options to monitor system in Linux

g) To see the process id of any specific process with 'ps' command

$ ps -C sshd -o pid=


how to use ps command in Linux to monitor processes


you can see the process name with the process id 

$ ps -q 1806 -o comm=

2:TOP Command : 

top displays the running processes in the monitoring format with current status. just type 'top' command to see the process current status. It will also show you the current ram , cpu , utilization as well as users login numbers , processes states numbers.

top commands usage to monitor Linux system


type  'h' for help or 'q' any time to quit.
some important options while using top command

z > for color 
E/e > get summary in human readable format
l > show load average row
t > show task average row
m > show memory average row
0 > to hide  zero values
F/f > add or remove fields in top column
L > find specific process
& > find again
V > forest view/hierarchy
r> renice process 
k > kill the process
U/u > specific user processes

3) Nice/Renice commands:

nice command is use to set the priority of any process while executing them. for example to run 'top' command with high priority run nice as :

nice -n -20 top

This will start top command with high priority. nice value range is -20 to +20. where -20 is highest and +20 is lowest. you can set any priority between these two values.

renice command is use to change the priority of already running process in system  , you can use with pid ,gid , userid

renice -n 'priority_number' -p | -u | -g




Post a Comment

0 Comments