Ps (Unix)

In most Unix and Unix-like operating systems, the codice_1 program (short for "process status") displays the currently-running processes. A related Unix utility named codice_2 provides a real-time view of the running processes.
Implementations.
KolibriOS includes an implementation of the command. The command has also been ported to the IBM i operating system. In Windows PowerShell, codice_1 is a predefined command alias for the codice_4 cmdlet, which essentially serves the same purpose.
Examples.
 PID TTY TIME CMD
 7431 pts/0 00:00:00 su
 7434 pts/0 00:00:00 bash
18585 pts/0 00:00:00 ps
Users can pipeline codice_1 with other commands, such as less to view the process status output one page at a time:
$ ps -A | less
Users can also utilize the codice_1 command in conjunction with the codice_7 command (see the codice_8 and codice_9 commands) to find information about a single process, such as its id:
$ # Trying to find the PID of `firefox-bin` which is 2701
$ ps -A | grep firefox-bin
2701 ? 22:16:04 firefox-bin
The use of codice_8 simplifies the syntax and avoids potential race conditions:
$ pgrep -l firefox-bin
2701 firefox-bin
To see every process running as root in user format:
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 1 0.0 0.0 9436 128 - ILs Sun00AM 0:00.12 /sbin/init --
Options.
codice_1 has many options. On operating systems that support the SUS and POSIX standards, codice_1 commonly runs with the options -ef, where "-e" selects every process and "-f" chooses the "full" output format. Another common option on these systems is -l, which specifies the "long" output format.
Most systems derived from BSD fail to accept the SUS and POSIX standard options because of historical conflicts. (For example, the "e" or "-e" option will display environment variables.) On such systems, codice_1 commonly runs with the non-standard options aux, where "a" lists all processes on a terminal, including those of other users, "x" lists all processes without controlling terminals and "u" adds a column for the controlling user for each process. For maximum compatibility, there is no "-" in front of the "aux". "ps auxww" provides complete information about the process, including all parameters.