ps -ef | grep 2811
user      2811  1800  0 10:15 ?        00:00:00 /usr/bin/python3 /path/to/script.py

Displays information about running processes.

  • -e: Lists all processes running on the system (not limited to your user).
  • -f: Provides a “full-format” listing, showing additional details such as the user, PID, parent PID, start time, and the command that started the process.

If the process doesn’t exist, the output will only show the grep command itself because grep 2811 is also a process. For example:

user      3456  3450  0 11:30 pts/1    00:00:00 grep 2811

To avoid this, you can exclude the grep process itself using:

ps -ef | grep 2811 | grep -v grep