if you are interested to contribute your LAB PROGRAM Please send mail to jkumaron@gmail.com

How To Find The Parent Process Tree Directory Structure | Change The Process Priority

By using Ps command we can find out the process id for the particular process.we can use to maintain the system in the proper manner. For example we are opening opera, but opera it is not opening, it will hang up the system, in these case we can find out the process id for the opera. and using kill command we can kill that particular process

#ps -ef | grep opera
rhel5 2190 1712 10 14:05 ? 00:00:03 /usr/lib/opera/opera
rhel5 2210 2190 21 14:05 ? 00:00:03 /usr/lib/opera//operapluginwrapper 52 69 /opt/mint-flashplugin/libflashplayer.so
rhel5 2211 2190 0 14:05 ? 00:00:00 /usr/lib/opera//operaplugincleaner 2190
rhel5 2231 2136 0 14:05 pts/1 00:00:00 grep --colour=auto opera
#kill -9 219
-f give the full details
-F give the Extra Full Details
#ps U Username
[root@vps ~]#ps U mysql >> find out the particular user Details
1109 ? Sl 757:51 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql
How to find the Process Tree
ps -axf
x -proces w/o controlling tty
#ps -axf
15230 pts/0 Ss 0:00 | \_ -bash
15396 pts/0 T 0:00 | \_ mysql
28459 pts/0 T 0:00 | \_ mysql
5785 pts/0 T 0:00 | \_ mysql
8826 pts/0 T 0:00 | \_ mysql
17588 pts/0 T 0:00 | \_ find / -name init.d*
18777 pts/0 T 0:00 | \_ find / -name init.d
813 pts/0 T 0:00 | \_ find / -name eth0*

We can also get the process tree using pstree command
-p refers to the process id
#pstree -p
pstree - display a tree of process.
pstree parent of all the process is init.
How To find out the particular command process id
Using command find the Process id
# pidof ssh
Using Process id find the Command
Method -1
ps -p 42 -o comm=
# ps -p 1154 -o comm=
# ps -p 385 -o comm=
Method -2
#ps -ef | grep processid
How to renice the process priority

User Define Ps command display
#ps -o pid,command

How to fine parent child process> ptree pid
nice command
nice value vary from -20 to 20.
-20 Most Favorable scheduling(Highest)
19 Least Favourable scheduling (Lowest)
How to change the value
#nice -n 10 gmplayer
#renice -n
#/bin/nice -n 3 command-name

To see the Directory structure we can use the following command
#tree Directory name
#tree $HOME
#tree /
To Display the Directory with size
we can use the following command
#tree -s >> size
#tree -d >> direcotry
#tree -a >>hidden files
#tree -p >> along with files

Related post