The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Some Info. ad4m88 UNIX for Dummies Questions & Answers 8 03-29-2008 03:01 PM
Need Info msgobinathan Shell Programming and Scripting 1 11-03-2007 01:17 PM
How get more LUN info itsupplies Linux 0 10-26-2006 01:22 AM
exe info sumsin High Level Programming 6 11-17-2005 01:15 AM
SU info afflack UNIX for Dummies Questions & Answers 4 01-20-2005 05:35 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-18-2006
Registered User
 

Join Date: Aug 2005
Posts: 10
Question PID info

Is it possible to find out what my PID is for the telnet session I am currentley using ?

Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-18-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,323
What OS are you using? On Sun, you can use ptree <pid of current shell>.
Reply With Quote
  #3 (permalink)  
Old 08-18-2006
Registered User
 

Join Date: Aug 2005
Posts: 10
We are Using HP Tru64 Unix
Reply With Quote
  #4 (permalink)  
Old 08-18-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,323
Try this script:
Code:
#!/bin/ksh

if [ $# -ne 1 ]; then
        echo "usage: proc_tree.sh <pid>"
        exit -1
fi
pid=$1
while [ $pid -ne 1 ]; do
        ps -ef | nawk -v awkpid=$pid '{if($2==awkpid) print }'
        pid=$(ps -ef | nawk -v awkpid=$pid '{if($2==awkpid) print $3}')
done
This will print parent processes all the way to init.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0