pgrep
Find process IDs by name
pgrep returns PIDs matching a name pattern. pgrep -f matches against the full command line. Combine with kill: kill $(pgrep nginx).
Example
$ pgrep nginx
1234
1235
1236
Tip: Type it yourself in the terminal below - reading is not the same as doing.