top -c
Top lists all the processes, there are good options to filter the processes by username by using the option -u but I am wondering if there is any easy way to filter the processes based on processname listed under COMMAND column of the top output.
For Example I would want like top -some option -substring of processname and top displays pids only having this substring in its command name
Using pgrep to get pid’s of matching command lines:
top
-pexpects a comma separated list of pids so we use-d','in pgrep. The-fflag in pgrep makes it match the command line instead of program name.