Google News
logo
Linux - Interview Questions
How do you find the process ID (PID) of a running process?
You can use the following command to find the Process ID or PID of the currently running process :

pgrep Command : The pgrep command shows the PID of a process through its name or other different attributes. For example, you can find the PID of process_1 using the below command:
pgrep <process_1>?


ps Command : ps command not only displays the currently running process but also shows the process’s PID. However, if you want to check the PID of a specific process, you can combine the ps with the grep command:
ps -e | grep -i <process_1> ?
Advertisement