Wednesday, March 16, 2011

How to Get Detailed Information About a Linux PID, Process ID

To get detailed information about a Linux PID you can use the strace command. If strace is not installed it can be installed via yum using the command below.

Strace Install:

1yum install strace

Below is a sample output from using the strace command on a Litespeed web server process.

Sample Output:


[root@idev log]# strace -p 14387


Realtime Example:

#ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
%CPU PID USER COMMAND
12.5 22288 root cp -Rvp /oracle/data/ /mnt/backup
0.4 31293 nagios /opt/nagios/bin/nagios -d /opt/nagios/etc/nagios.cfg
0.3 16481 root top
0.2 4024 root hpasmd
0.1 4645 root cmanicd
0.1 23378 tinydns /usr/local/bin/dnscache
0.0 9 root [kacpid]
0.0 9880 apache /opt/apache/bin/httpd
0.0 8 root [khelper]

# strace -cp 22288
Process 22288 attached - interrupt to quit
Process 22288 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
56.29 0.459280 20 23088 write
43.71 0.356596 15 23089 read
------ ----------- ----------- --------- --------- ----------------
100.00 0.815876 46177 total

No comments:

Post a Comment