[X-Unix] Command to find if a certain app is running?

TjL luomat at gmail.com
Fri Mar 27 07:24:13 PDT 2009


On Fri, Mar 27, 2009 at 2:58 AM, Christoph Hammann <chammann at mac.com> wrote:
> The first command you're looking for is ps aux | grep processname . The
> second is apropos .
>

It is often a good idea to throw out 'grep' in the responses for grep
(and, the 'w' as someone else mentioned)

ps auxwwwww | grep iTunes | grep -v grep

(which also illustrates the problem of "helper" apps, in that the
above command will show you iTunes and iTunesHelper)

However, if you forgo "w" for "c" you get a more compact format

$ ps auxc | fgrep iTunes
luomat    8613   0.4  3.2  1156752 134316   ??  S    10:02AM   0:55.42 iTunes
luomat     309   0.0  0.1   363236   3636   ??  S    17Mar09   0:01.57
iTunesHelper

makes it a little easier. But using egrep and $ will get us even closer

$  ps uxc | egrep "iTunes$"
luomat    8613   0.4  3.2  1156752 134316   ??  S    10:02AM   0:55.60 iTunes


The best solution is probably to check what happens with the specific
app you are looking for.  Also, whether or not you want the 'a' flag
or not will depend on your situation.

TjL


More information about the X-Unix mailing list