To find a process by name on a Linux system, you can use the ps
command with the -C
option, followed by the name of the process. For example, to find a process with the name httpd
, you can use the following command:
ps -C httpd
This will display a list of all processes with the name httpd
.
You can also use the grep
command to filter the output of the ps
command to find a specific process. For example, to find the process ID (PID) of the httpd
process, you can use the following command:
ps -ef | grep httpd | grep -v grep | awk '{print $2}'
This command will display the PID of the httpd
process.
Alternatively, you can use the pgrep
command to find the PID of a process by name. For example:
pgrep httpd