Finding Process ID and Process Name in Linux

If you have to find the process ID, you will use the pidof command.

pidof <process_name>

Similarly, if you have a PID number of a process, you can find the name of that PID by using the command:

ps -q <PID Number> -o comm=

Also, you can find the PID of only processes with a particular name (like gedit), using:

ps -C <name-of-process> -o pid=

1 Like