If you call the top command, you get all the running processes. But how can I limit the output only to a certain process name like \"java\"?
I\'ve
The following code updates a list of processes every 5 seconds via the watch command:
watch -n 5 -t top -b -n 1 -p$(pgrep java | head -20 | tr "\\n" "," | sed 's/,$//')