On Sep 2, 12:26 pm, herman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to find out all the process id with the process name
> 'emacs'.
>
> In the shell, i can do this:
>
> $ ps -ef |grep emacs
> root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk
> root 25649 25357 0 13:55 pt
>
> cd /proc
> for i in ls [0-9]*/status
> do
> echo $i `grep '^Name' $i | cut -f2` | sed 's/\/status//g'
> done
>
Um...
cd /proc
for i in `ls [0-9]*/status`
do
echo $i `grep '^Name' $i | cut -f2` | sed 's/\/status//g'
done
---
Let the wookie win.
--
http://mail.python.org/mailma
On Sun, 02 Sep 2007 19:26:27 +, herman wrote:
> But now I would like to do the programmically in my python script. I
> know I can use ' os.system(cmd)' to execute the command 'ps -ef | grep
> emacs', but how
> can I pipe the output of my 'ps -ef | grep emacs' to my python script
> and then run
On Sep 2, 2007, at 12:26 PM, herman wrote:
> I would like to find out all the process id with the process name
> 'emacs'.
>
> In the shell, i can do this:
>
> $ ps -ef |grep emacs
> root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk
> root 25649 25357 0 13:55 pts/900:00:05 e
the easiest but slowest way:
you can send output to a file
ps -ef |grep emacs > output_file
and then read the file content
(I believe there is a much better way)
On 9/2/07, herman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to find out all the process id with the process name
> 'emacs
Hi,
I would like to find out all the process id with the process name
'emacs'.
In the shell, i can do this:
$ ps -ef |grep emacs
root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk
root 25649 25357 0 13:55 pts/900:00:05 emacs-snapshot-gtk rtp.c
root 26319 23926 0 14:06 pts