HI,
i used
ps -ef | grep 3539052 | grep -v grep
and i got a output like ths
root 3539052 3407918 0 May 07 - 709:31 /usr/sbin/syslogd
but what i need is instead of full path /usr/sbin/syslogd i want only the process name that is 'syslogd' here.
sea
2
echo $(basename $(ps -ef | grep 3539052 | grep -v grep|awk '{print $8}'))
Should do the trick
1 Like
thanks sea....its workin for me
Scott
4
This should work in AIX (although only able to test is on BSD and RHEL):
ps -p 3539052 -o comm=
For example:
[root@ns1 /]# ps -ef | grep [1]471
root 1471 1 0 08:02 ? 00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
[root@ns1 /]# ps -p 1471 -o comm=
rsyslogd
1 Like