Bootstrap FreeKB - Linux Commands - ps command (process PID)
Linux Commands - ps command (process PID)

Updated:   |  Linux Commands articles

The ps command can be used to view a static snapshot of active processes. The top command can be used to view processes in real time. The ps command without any options will display only the processes being used by the current user in the current shell.

[john.doe@server1 ]# ps
 PID  TTY        TIME  CMD
4012  pts/2  00:00:00  bash
4657  pts/2  00:00:00  ps

 

 


grep

Often, the grep is used with the ps command.

[john.doe@server1 ]# ps | grep foo

 

This will always show that the grep command itself has a PID.

john.doe  29124  23915  0  03:02  pts/0  00:00:00 grep --color=auto foo

 

If you want to remove grep from the output, do this.

[john.doe@server1 ]# ps | grep foo | grep -v grep

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 8ff63f in the box below so that we can be sure you are a human.