The ps
perintah lebih cocok untuk tugas semacam ini. Coba sesuatu seperti ini:
$ ps -ao bsdstart,fuser,pid,%cpu,%mem,args | grep jre
Dari ps
halaman manual:
ps menampilkan informasi tentang pilihan proses yang aktif. Jika Anda menginginkan pembaruan berulang dari seleksi dan informasi yang ditampilkan, gunakan top (1) sebagai gantinya.
Dalam perintah yang saya sarankan, opsi '-a' memberitahu ps
proses pencetakan untuk semua pengguna. The -o
menentukan format output. Dalam contoh saya (lagi dari ps
halaman manual):
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.
Anda dapat mengubah ini sesuai dengan kebutuhan Anda. Lihat man ps
dan cari "SPESIFIKASI FORMAT STANDAR" (Anda dapat menggunakan pencarian vi-style di halaman manual, tekan "/" dan masukkan pola pencarian Anda, "n" akan pindah ke pertandingan berikutnya).