O comando ps
é mais adequado para esse tipo de tarefa. Tente algo assim:
$ ps -ao bsdstart,fuser,pid,%cpu,%mem,args | grep jre
Na página ps
man:
ps displays information about a selection of the active processes. If
you want a repetitive update of the selection and the displayed
information, use top(1) instead.
No comando que sugeri, a opção '-a' informa ps
para imprimir processos para todos os usuários. O -o
especifica o formato de saída. No meu exemplo (novamente na página ps
man):
bsdstart : time the command started. If the process was
started less than 24 hours ago, the output format
is " HH:MM", else it is " Mmm:SS" (where Mmm is
the three letters of the month). See also
lstart, start, start_time, and stime.
fuser : filesystem access user ID. This will be the
textual user ID, if it can be obtained and the
field width permits, or a decimal representation
otherwise.
pid : a number representing the process ID (alias tgid).
%cpu : cpu utilization of the process in "##.#" format.
Currently, it is the CPU time used divided by the
time the process has been running
(cputime/realtime ratio), expressed as a
percentage. It will not add up to 100% unless
you are lucky. (alias pcpu).
%mem : ratio of the process's resident set size to the
physical memory on the machine, expressed as a
percentage. (alias pmem).
args : command with all its arguments as a string.
Modifications to the arguments may be shown. The
output in this column may contain spaces. A
process marked <defunct> is partly dead, waiting
to be fully destroyed by its parent. Sometimes
the process args will be unavailable; when this
happens, ps will instead print the executable
name in brackets. (alias cmd, command). See
also the comm format keyword, the -f option, and
the c option.
When specified last, this column will extend to
the edge of the display. If ps can not determine
display width, as when output is redirected
(piped) into a file or another command, the
output width is undefined (it may be 80,
unlimited, determined by the TERM variable, and
so on). The COLUMNS environment variable or
--cols option may be used to exactly determine
the width in this case. The w or -w option may
be also be used to adjust width.
Você pode alterar isso para atender às suas necessidades. Dê uma olhada em man ps
e procure por "STANDARD FORMAT SPECIFIERS" (você pode usar a busca no estilo vi em man pages, pressionar "/" e digitar seu padrão de busca, "n" irá para a próxima coincidência).