I'm run top and I want to always see java/tomcat/redis/mysql/mongo, is that possible?
You could to something like this
top -p `pgrep -d ',' "java|tomcat|redis|mysql|mongo"`
pgrep to produce a comma separated list of pid's that are passed to
Not quite what you're looking for, but sometimes a process is run by it's own user, like apache2 is often run by user www-data.
You can use that to limit top's output to only the processes by that user, effectively only showing apache2 processes by using this command:
top -u www-data
alias mytop='echo $(sed "s/\([0-9]*\)/-p \1/g;s/^/top /" <(pgrep -d" " "java|redis|mysql|mongo"))' mytop
Check man top manual page for more details about top utility...
Semms you need -p parameter
-p : Monitor PIDs as: -pN1 -pN2 ... or -pN1, N2 [,...]
Monitor only processes with specified process IDs. This option can be given up to 20 times, or you can provide a comma delimited list with up to 20 pids. Co-mingling both approaches is permitted.