TrumanWong

pidof

Find the process ID number of the process with the specified name

Supplementary instructions

pidof command is used to find the process ID number of the process with the specified name.

grammar

pidof(option)(parameter)

Options

-s: only returns a process number;
-c: Only show processes with the same "root" directory;
-x: Display processes started by scripts;
-o: Specify the process ID not to be displayed.

Parameters

Process name: Specify the name of the process to find.

Example

pidof nginx
13312 5371

pidof crond
1509

pidof init
1