Linux Commands - Important 10 Linux Ps Command With Examples

Why i love linux??? the answer, i use linux because like with the commands of CLI. This post i will discuss 10 Ps Command In Linux, yep linux was built-in tool to capture current process in the system since this operating system inspired from Unix.

What Is PS Command???

Ps is acronym Process Status, used to provide information about the currently running processes, including their process identification numbers (PIDs). (source:

From its manual page, PS gives a snapshots of the current process. It will “capture” the system condition at a single time. If you want to have a repetitive updates in a real time, we can use top command.

PS support three (3) type of usage syntax style.

  1. UNIX style, which may be grouped and must be preceded by a dash
  2. BSD style, which may be grouped and must not be used with a dash
  3. GNU long options, which are preceded by two dash

We can mix those style, but conflicts can appear. In this article, will use UNIX style. Here’s are some examples of PS command in a daily use.

1. Show All Current Process

Here i use simple ps command with options ax, this option a is acronym all and x will show all process even the current process is not associated with any TTY (terminal).

Here this command:

# ps ax

This result might be long result. To make it more easier to read, combine it with less command.

# ps ax | less

2. Filter Process By User

The ps command will show process which run by user, for show processing by user use option -u. Here i will see for you process with user gunzip.

# ps -u gunzip 

3. Filter Processes By Memory Usage Or CPU

If you want see result memory usage or CPU, type ps command with aux options and you’ll see:

# ps -aux | less 

Since the result can be in a long list, we can pipe less command into ps command.
By default, the result will be in unsorted form. If we want to sort by particular column, we can add –sort option into ps command.

Sort by the highest CPU utilization in ascending order and sort by the highest Memory utilization in ascending order

# ps -aux --sort -pcpu | less

# ps -aux --sort -pmem | less 

This example i will combine a command, will display like below image.

# ps -aux --sort -pcpu,+pmem | head -n 10

4. Filter Process By Name Process ID

This i will use options -C for filter process, and i will filtering amarok process with following command:

$ ps -C amarok

If you want see more result, you can add -f options for show full listing. See this following command:

$ ps -f -C amarok

5. Filter Processes By Thread Of Process

This ps command will show process by thread fit PID (Process ID). For running this command add -L options, like this command:

$ ps -L 16014

The above screenshot was tell, the PID remain same value but LWP which shows rows different values of thread.

6. Show Process In Hierarchy

For show processes by hierarchical form, use options -axjf like this:

$ ps -axjf

Or other command you can use pstree

$ pstree

7. Show Security Information

If want see information about security using ps command, you can use command:

$ ps -eo pid,user,args

Option -e will show you all processes while -o option will control the output. Pid, User and Args will show you the Process ID, the User who run the application and the running application.

The keyword / user-defined format that can be used with -e option are args, cmd, comm, command, fname, ucmd, ucomm, lstart, bsdstart and start.

8. Show Every Process As Root (real & effecitve ID) in user format

ß System admin may want to see what processes are being run by root and other information related to it. Using ps command, we can do by this simple command :

$ ps -U root -u root u

The -U parameter will select by real user ID (RUID). It selects the processes whose real user name or ID is in the userlist list. The real User ID identifies the user who created the process.
While the -u paramater will select by effective user ID (EUID)
The last u paramater, will display the output in user-oriented format which contains User, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME and COMMAND columns.
Here’s the output of the above command.

9. Ps Command For See A Realtime Process Viewer

ps will display a report of what happens in your system. The result will be a static report.
Let say, we want to filter processes by PID, User, Detail Command, CPU and Memory usage. And we want the report is updated every 1 second. We can do it by combining ps command with watch command on Linux.
Here’s the command :

$ watch -n 1 'ps -e -o pid,uname,cmd,pmem,pcpu --sort=-pmem,-pcpu | head -15'

10. Displayed Elapsed Time Of Process

This command options almost same with point 7 in above, but user and args not used. See this command:

$ ps -eo pid,comm,etime


This ps command you can use for monitor usage daily activity about what happen in your linux systems. You can generate variant options with ps, i think ps it’s better for system administrator which work without GUI.

Don’t forget for see documentation of ps with command man ps.


This post is licensed under CC BY 4.0 by the author.