Javatpoint Logo
Javatpoint Logo

ps Command in Linux/Unix with Examples

The ps command is used to view currently running processes on the system. It helps us to determine which process is doing what in our system, how much memory it is using, how much CPU space it occupies, user ID, command name, etc .

Introduction to ps Command

The ps command shows details of a selection of the running processes. If we wish repetitive selection updates and displayed information, we can use the top command rather.

This version of the ps command accepts many types of options, which are mentioned below:

  • UNIX options may be unified and must be followed by a dash.
  • GNU long options are followed by two dashes.
  • BSD options may be unified and must not be utilized with a dash.

Different types of options may freely be mixed, but clashes can occur. There are a few synonymous options, functionally identical, because of several ps implementations and standards that the ps command is compatible with.

Note: The ps -aux command is different from the ps aux command. The UNIX and POSIX standards need that the ps -aux command print every process owned by any user named x and print every process that will be chosen by the -a flag.

  • If the usernamed x doesn't exist, the ps command may interpret the command as the ps aux command rather and display a warning. This type of behavior helps in transitioning old habits and scripts. It is subject to change, fragile, and hence shouldn't be relied upon.
  • The ps command chooses every process with a similar effective user ID as the current user and corresponding to a similar terminal as an invoker by default. It shows the process ID, the terminal corresponding to the process, the cumulated CPU time in the [DD-]hh:mm:ss format, and the executable name. By default, the result is unsorted.
  • The usage of the BSD-style options will include process state to the default display and display the command arguments rather than the executable name. We can override it using the environment variable, i.e., PS FORMAT.
  • Also, the usage of the BSD-style options will modify the process selection to add processes on many terminals owned by us. It may alternatively be specified as configuring the selection to be the group of every process filtered for excluding processes owned by some other users or not on any terminal.
  • These consequences aren't considered if options are specified as being identical, so the -M option will be taken as identical to the Z option, and so on.

Implementations of ps Command

KolibriOS contains the ps command implementation. Also, this command has been ported to IBM i OS. The ps command is a predefined command alias in Windows PowerShell for the Get-Process cmdlet, which essentially serves a similar purpose.

Header line

  • %CPU: It shows how much the process is using the CPU.
  • %MEM: It shows how much the process is using memory.
  • ADDR: It shows the memory address of a process.
  • CP or C: It shows scheduling information and CPU usage.
  • COMMAND*: It shows the process name, including arguments if available.
  • NI: It shows nice value.
  • F: It displays flags.
  • PID: It shows the number of a Process ID.
  • PPID: It shows the number of the parent processes of the process.
  • PRI: It shows the process's priority.
  • RSS: It stands for Resident set size.
  • STAT or S: It shows the status code of the process.
  • STIME or START: It shows the time when a process started.
  • TIME: It shows the CPU time amount utilized by a process.
  • VSZ: It shows virtual memory usage.
  • TTY or TT: It shows the terminal corresponding to the process.
  • USER or UID: It shows the username of the owner of the process.
  • WCHAN: It shows an event's memory address the process is delaying for.

Environment Variables of ps Command

Below environment variables will affect the ps execution:

  • COLUMNS: It overrides the line size of the system-selected horizontal display, used for determining the total of text columns to show.
  • LANG: It offers the default value for an internationalization variable that is null or unset.
  • LC_ALL: It overrides the values of every internationalization variable if set to any non-empty string value.
  • LC_CTYPE: It regulates the locale for the interpretation of text data's byte sequences as characters (for instance, single-byte in contrast to multi-byte characters within the arguments).
  • LC_TIME: It regulates the contents and formats of the time and date strings shown.
  • LC_MESSAGES: It regulates the locale that should be utilized for affecting the contents and formats of diagnostic messages specified to standard bug and informative messages specified to standard output.
  • NLSPATH: It determines the message catalog location for the implementation of LC_MESSAGES.
  • TZ: It determines the timezone utilized for calculating time and date strings shown. An undefined default timezone will be used if TZ is null or unset.

The ps command may display different results for different systems because it displays information about the currently running process of a system.



Look at the above snapshot, 4 columns are displayed as the output.

  • PID is the process ID of running command
  • TTY is the type of terminal where current command is running
  • TIME tells how much time is used by CPU to run the process
  • CMD is current command

ps command supports 3 types of usage syntax style

  • Unix, may be grouped and preceded by hyphen
  • BSD, may be grouped but not preceded by hyphen
  • GNU, long options and preceded by double hyphens


Option Function
ps -ef / -aux List currently running process in full format
ps -ax List currently running process
ps -u <username> List process for specific user
ps -C <command> List process for given command
ps -p <PID> List process with given PID
ps -ppid <PPID> List process with given ppid
pstree Show process in hierarchy
ps -L List all threads for a particular process
ps --sort pmem Find memory leak
ps -eo Show security information
ps -U root -u root u Show process running by root

Linux ps -ef and ps -aux

To display all currently running processes in full format on a system two types of commands are used.



e displays all the processes

f displays full format listing



Look at the above snapshot, it display all the running processes on our system.



Look at the above snapshot, this command filter the result by CPU or memory usage. It helps you in determining how much memory is used or how much CPU space is used by a process.

Linux ps -ax

This command display all the processes in a system. Here, a stands for all. It will display a long list of result.



Look at the above snapshot, it does not display information in full format but shows a list of all the processes running in the system.

Linux ps -u <username>

Option u displays the process for a specific user. You can also specify multiple usernames separated by a comma between them.



ps -f -u akki,sssit


Look at the above snapshot, it display the processes of akki and sssit with "ps -f -u akki,sssit" command.

Linux ps -C <command>

Option C display a list of processes with the mentioned command as argument.




Look at the above snapshot, it displays all the processes which has firefox in its command execution.

Linux ps -f -p <PID>

Each process is assigned with a specific Process ID number.

A process may have many sub process listed under it. Each of these sub process will also have its own PID number. So, a process will have its own PID number and may have a parent PID number.

Option p display list of the processes having the mentioned PID number.




Look at the above snapshot, it displays the processes with the mentioned PID numbers.

Linux ps -f --ppid <PPID>

As mentioned earlier, some process may have PPID along with PID number. All the sub processes having same PPID number may be listed by mentioning PPID number.



ps -f --ppid 1517


Look at the above snapshot, all the sub processes of PPID 1517 are listed here.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA