How to get only process ID in specify process name in Linux? January 27, 2023 by Tarik You can pipe your output to awk to print just the PID. For example: ps -ef | grep nginx | awk '{print $2}' 9439