I am running the code in terminal and in script:
ps aux | grep mysqld
But it also shows grep command. Is there any way to exclude grep from ps command outputs and final result?
I am running the code in terminal and in script:
ps aux | grep mysqld
But it also shows grep command. Is there any way to exclude grep from ps command outputs and final result?
Are you looking for the PID? Try the pgrep command instead of ps aux | grep '....'
. It looks through the currently running processes and lists the process IDs (PIDs) which match the selection criteria to screen.
pgrep mysqld
You can search for processes called nginx/php-cgi AND owned by nginx user only:
pgrep -u nginx nginx
pgrep -u nginx nginx,php-cgi
ps aux | grep mysqld | grep -v grep
pgrep mysqld
[m]ysqld
:ps aux | grep '[m]ysqld'
Do check the following page for more info