determine pid from ps -ef | grep something


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers determine pid from ps -ef | grep something
# 1  
Old 09-26-2007
determine pid from ps -ef | grep something

Hi all,

i have a script called a.sh and within a.sh it calls b.sh.

when i do a ps -ef | grep a.sh, i get two sets of number

user_test 4225 3250 0 10:31 pts/1 00:00:00 a.sh

when i do a ps -ef | grep b.sh, i get two sets of number

user_test 4269 4225 22 10:31 pts/1 00:00:45 b.sh

why are there there two sets of numbers? which is the pid of a.sh and b.sh respectively?
# 2  
Old 09-26-2007
From the listing the first number is the process id, the second number is that processes' parent.
# 3  
Old 09-26-2007
thanks porter.
# 4  
Old 09-26-2007
nimish

user_test 4225 3250 0 10:31 pts/1 00:00:00 a.sh
UID PID PPID C STIME TTY TIME cmd
# 5  
Old 09-26-2007
Very easy:
Code:
man ps

# 6  
Old 02-03-2008
Hi,

i would like to clarify certain columns. I tried to man ps, and i was not able to understand the information provided. In the man pages, it states the flag -f was to print out the full-format listing, however it does not say what information comes with the full-format listing. May i know what does C, STIME,TTY and TIME means? I reckon STIME means start time and time means it has been running for how long?
# 7  
Old 05-03-2009
Error

Hello,

i am trying to upgrade my aptitude (i mean "sudo aptitude upgrade") ! but i get an error with a resource taken by another process.

i typed ps -e and killed one process ("update-agent" i think), but it was not the one.

i can't remember the command line with grep to identify which process is holding the hand of that file.

the file is /var/lib/dpkg/lock

can i find the one using grep and something ?

thanks.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How to grep PID and program name from netstat in AIX?

Hi All, I am using netstat on AIX to grep info on all open connections. However, unlike on Linux(Centos), I do not get the PID and program name using netstat on AIX. I need this info to be clubbed along with the information retrieved using netstat version of AIX. Is there a way this can be... (1 Reply)
Discussion started by: Vipin Batra
1 Replies

2. UNIX for Dummies Questions & Answers

Determine uniqueness of pid to name output files

Hi, We've a process on AIX UNIX server which is executed by multiple uses during a day. I wish to create a log file for every time the process is executed. I wish to know how unique are PID(s) on AIX UNIX servers if I were to name the log files with <date> and <PID>? E.g. If I create my... (1 Reply)
Discussion started by: vkumbhakarna
1 Replies

3. Shell Programming and Scripting

Error in finding the PID by grep and assigning to a variable

Hello All, I am facing difficulty in getting the PID value & then assigning it to a variable, kindly help me in resolving the issue. Thanks a lot in advance. The custom utility used inside the Test2.sh will process the file in a batch of 10 lines at once and for efficient memory management,... (3 Replies)
Discussion started by: duddukuri
3 Replies

4. Shell Programming and Scripting

grep PID and collect data ?

I have a file current.csv file 2011/05/06 11:12:20 | 16:guest pid=014782 opened Boards 0, 1, 2, 3 2011/05/06 12:23:13 | 16:guest pid=014782 closed 2011/05/06 12:26:05 | 17:guest pid=022383 opened Boards 0, 1, 2, 3 2011/05/06 20:09:04 | 17:guest pid=022383 closed 2011/05/06... (5 Replies)
Discussion started by: sabercats
5 Replies

5. Shell Programming and Scripting

Using grep to extract PID

Hi unix experts! I need help to solve the following problem: I'm getting the prstat info: stats=`prstat 0 1` #dont worry about how many processes are running I'm aware that no all processes will be listed without the -n (specify number) then I'm doing the following to extract the... (2 Replies)
Discussion started by: sanjaybhatt6
2 Replies

6. Shell Programming and Scripting

how to grep parent process PID in shell scripting

hi all, for an example: $ ps -ef | grep apache | awk '{ print $2, $3 }' 24073 11784 28021 1 28022 1 28038 1 28041 28040 28045 28041 28047 28041 28040 1 28049 28041 28051 28041 28053 28041 28030 1 28054 28041 28055 28041 28056 28041 28057 28041 (5 Replies)
Discussion started by: raghur77
5 Replies

7. UNIX for Dummies Questions & Answers

Need to get pid of a process and have to store the pid in a variable

Hi, I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this. Thanks in advance, Amudha (7 Replies)
Discussion started by: samudha
7 Replies

8. Shell Programming and Scripting

KILL PID, intern should kill another PID.

Hi All, In my project i have two process runs in the back end. Once i start my project, and execute the command ps, i get below output: PID TTY TIME CMD 9086 pts/1 0:00 ksh 9241 pts/1 0:02 java 9240 pts/1 0:00 shell_script_bg java with 9241 PID is the main... (4 Replies)
Discussion started by: rkrgarlapati
4 Replies

9. UNIX for Dummies Questions & Answers

Session PID & socket connection pid

1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection? 2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies

10. Programming

printing ppid,child pid,pid

question: for the below program i just printed the value for pid, child pid and parent pid why does it give me 6 values? i assume ppid is 28086 but can't figure out why there are 5 values printed instead of just two! can someone comment on that! #include<stdio.h> #define DIM 8 int... (3 Replies)
Discussion started by: a25khan
3 Replies
Login or Register to Ask a Question