To display statistics only for a process name that match a string using top, you could use the following:
top -c -p $(pgrep -d',' -f firefox)
Here is a screenshot which only shows stats for firefox:
Hope this helps! Cheers!
Source/Credits/Reference: StackOverflow
Another method:
Press the ‘o’ or ‘O’ to activate filter prompt. It will show a line indicating the filter format like this –
add filter #1 (ignoring case) as: [!]FLD?VAL
Then enter a filter like this and hit Enter.
COMMAND=apache
Now top will show only those processes whose COMMAND field contains the value apache.