Linux Commands - ps command (process PID)

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




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

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |