16.7 pgrep and pidof: Finding PIDs by Name
Right, so you’ve got a process running. You can hear its digital heartbeat, sucking up CPU cycles and memory, but you have no idea what its Process ID (PID) is. You could run ps aux | grep and start squinting at a wall of text, hoping you spot the right one. But let’s be honest, that’s what our ancestors did. We have better tools. Enter pgrep and pidof—two commands that exist for the singular, beautiful purpose of turning a process name into its PID, saving you from that grep-induced eyestrain.