ps command is one of the basic Unix commands that helps you access information about processes running on your system.
Show processes of the current user
Simply type “ps” in the command line to see which processes you’re currently running on your Unix/Linux system. As you can see from the listing, I’m running bash shell and then ps command.
Show full information about processes
Using the -f option for ps you can gain additional useful information on each process in the listing: usernames (UID), process ID (PID), parent process ID (PPID) and full command lines (not just the process name). In this example I’m still looking at my own processes, but really -f is a modifier – so you can use in combination with any other ps command options:
One immediately obvious thing from this listing is that bash (process ID 26344) is actually the parent process of my ps -f command (see how it shows PPID of 26344) – this makes perfect sense, obviously: we ran ps by typing a command in the bash shell prompt.
Show all the processes on the system
This will show not only your own processes, but all the other processes running under different users as well. Combined with the -f option, this gives us a fairly useful output:
INTERESTING: this output shows a few more processes running under my username greys: they were not started directly by me but are still needed and managed under my user.
Show securty contexts in RedHat/CentOS/Fedora
If your system is SELinux capable, you can get SELinux context information with the Z flag to the ps command. Here I’m looking at the contexts of everything running under my own username: