Ps (Unix)
Encyclopedia
In most Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems, the ps program (short for "process status") displays the currently-running processes
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...

. A related Unix utility named top
Top (Unix)
top is a program found in many Unix-like operating systems. It produces an ordered list of running processes selected by user-specified criteria, and updates it periodically. Default ordering by CPU usage, and only the top CPU consumers shown top shows how much processing power and memory are...

 provides a real-time view of the running processes.

The ps command is analogous to the Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 tasklist command.
In Windows PowerShell
Windows PowerShell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

, ps is a predefined command alias for the Get-Process cmdlet which basically serves the same purpose.

Examples

For example:

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 also utilize the ps command in conjunction with the grep
Grep
grep is a command-line text-search utility originally written for Unix. The name comes from the ed command g/re/p...

(see the pgrep
Pgrep
pgrep is a command-line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and the BSDs . It searches for all the named processes that can be specified as extended regular expression patterns, and—by default—returns their process ID...

and pkill
Pkill
pkill is a command-line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and some BSDs.As with the kill and killall commands, pkill is used to send signals to processes...

commands) command to find information about one process, such as its process id:


$ # Trying to find the PID of `firefox-bin` which is 2701
$ ps -A | grep firefox-bin
2701 ? 22:16:04 firefox-bin

and the easier version with pgrep
Pgrep
pgrep is a command-line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and the BSDs . It searches for all the named processes that can be specified as extended regular expression patterns, and—by default—returns their process ID...

:


$ pgrep -l firefox-bin
2701 firefox-bin


To see every process running as root (real & effective ID) in user format:
  1. ps -U root -u root u

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 10348 640 ? Ss 2009 0:06 init [5]

Options

ps has many options. On operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s that support the SUS
Single UNIX Specification
The Single UNIX Specification is the collective name of a family of standards for computer operating systems to qualify for the name "Unix"...

 and POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 standards, ps 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 cause the display of environment variable
Environment variable
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...

s).
On such systems, ps commonly runs with the non-standard options aux, where "a" lists all processes on a terminal
Computer terminal
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system...

, including those of other users, "x" lists all processes without controlling terminals and "u" adds a column for the controlling user for each process. Note that, for maximum compatibility when using this syntax, there is no "-" in front of the "aux". Also you can add 'ww' after aux, like "ps auxww" for complete information about the process including all parameters.

See also

  • kill
  • List of Unix programs
  • nmon
    Nmon
    nmon is a popular system monitor tool for the AIX and Linux operating systems.- Description :The original nmon was a freely downloadable tool for AIX 4.3 from the AIX wiki. It was also rewritten for the Linux operating system running on IA-32, x86-64, RS/6000 and Power processor and Mainframe and...

    — a system monitor tool for the AIX and Linux operating systems.
  • pgrep
    Pgrep
    pgrep is a command-line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and the BSDs . It searches for all the named processes that can be specified as extended regular expression patterns, and—by default—returns their process ID...

  • pstree
    Pstree (Unix)
    pstree is a Unix command that shows the running processes as a tree. It is used as a more visual alternative to the ps command. The root of the tree is either init or the process with the given pid.-See also:*top*ps*kill*nice*tree-External links:...

  • top
    Top (Unix)
    top is a program found in many Unix-like operating systems. It produces an ordered list of running processes selected by user-specified criteria, and updates it periodically. Default ordering by CPU usage, and only the top CPU consumers shown top shows how much processing power and memory are...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK