cancel
Showing results for 
Search instead for 
Did you mean: 

System process

haeman
Frequent Advisor

System process

I know the path /proc have the user process in it , I use ll /proc and grep my login id , there are some process is display , but I found that some of these process is not real process , if I su other user then grep my_id again , it only display process id - 18257 , 18258 , these two process are really the process that I used in the system , can advise what make the difference ? how can I use my login id to grep my process without other unrelated process shown ?
Thx in advance.

$ ll /proc |grep my_id
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 14518
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 16816
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18255
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18256
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18257
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18258

su - ora_id
$ ll /proc |grep my_id
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18257
dr-xr-xr-x 3 my_id edp 0 Jan 17 15:49 18258
10 REPLIES
Alexander Chuzhoy
Honored Contributor

Re: System process

1. When you do ll as my_id - you actually start another process as my_id, which isn't happening when you do ll as ora.

2. /proc has a directory for every process under it, but in general use `ps` with various options combinations like `ps aux` or `ps ef` to list running processes.
haeman
Frequent Advisor

Re: System process

thx reply ,

except use ps , how can I make use the process in /proc to find the user process ?

Please advise . thx
haeman
Frequent Advisor

Re: System process

--> When you do ll as my_id - you actually start another process as my_id, which isn't happening when you do ll as ora.

I know this is the reason , can advise how to solve it ? thx
Alexander Chuzhoy
Honored Contributor

Re: System process

I'm not sure how usefull it is, but here's the line:
for i in `ll /proc|grep |awk '{print $NF}'`; do test -d /proc/${i}; if [ $? -eq "0" ]; then echo $i; fi; done


replace the string with the username.
haeman
Frequent Advisor

Re: System process

for i in `ll /proc|grep |awk '{print $NF}'`; do test -d /proc/${i}; if [ $? -eq "0" ]; then echo $i; fi; done


thx

I try your script above , it will display less unrelated process , but still have ONE unrelated process , can advise how to erase it ? thx
Alexander Chuzhoy
Honored Contributor

Re: System process

Check what command starts this process.
cat /proc//cmdline
haeman
Frequent Advisor

Re: System process

--> cat /proc//cmdline

what is the use to check the command to start this process ?

thx
Alexander Chuzhoy
Honored Contributor

Re: System process

So that you'll know why this procees was started in the first place.
replace with the process number of the process that is bothering you.

Please assign points.
Stuart Browne
Honored Contributor

Re: System process

Why not just 'ps -u ' ? It'll get your processes.

If you just want the pid's, you can do that too with 'ps -u -opid='.
One long-haired git at your service...
dirk dierickx
Honored Contributor

Re: System process

yeah, walking and searching proc seems more trouble then it's worth. just get the list of pids with 'ps' and then you know which directories in /proc to use for whatever you want to do.