Our Thoughts About Software Design And Development

Different ways to use ps command in Linux

The ps program is the one of the most common tool in the linux operating system. The system administrator uses it. It provides a real-time glimpse at the list of running processes. We have listed some of the best ways you can ps command along with a single dash as it is most used syntax.

Run ps without any options

This is a very basic ps usage. Just type ps on your console to see its result.

Show All Processes

Command Used: ps -ef

This will show the current running processes along with the data related to every process. The data consists of columns displaying PID, terminal type, command name and time running.

Filter Processes By Process Name

Command used – ps -C name

You will display processes by the process name, which will be in lower case. It will search via all processes without -eprefix.

Sort Processes By User

Command Used: ps -e -u

You can filter ps results to get processes under a particular username. You can also use it without prefix.

Sort Processes by Process ID

Command Used: ps -ef -p 1234,5678,9012

If you know what is process ID of a certain running process, you can filter it by using process ID.

Shows Specific Columns

ps -e -o pid,uname,pcpu,pmem,comm

With -o flag, you get particular output display options for results of ps command.

Grep within Results

Command Name: ps -ef | grep worker

If you want to search inside the results from ps, you can pipe the results to grep. With this command you can search via usual expressions for pattern-matching.

Filter Processes through Usage

Command Used: ps -e –sort=-pcpu -o pid,pcpu,comm

It filters command using listed columns. The – prefix filters the feature in decreasing order and the + prefix filters the feature in increasing order. The command also has -o command which displays specific columns.

Mix & Match Renamed and Default Name Columns

Command Used: ps -e -o pid,pcpu=CPU -o pmem=RAM,comm

If you wish to hide the headers in specific columns, then you can leave a blank just after = sign. If you want to mix & match renamed and default name columns, then you need -o flag for each renamed column.

Name Column Headers Again

Command Used: ps -o pid=Process,ruser=RealUser,comm=Command

You can rename the columns using -o command. You need to attach = sign and the desired name and -o flag for every renamed header.

Display All Root Processes

Command Used: ps -f -U root -u root

It runs a search for all running processes with original and efficient root identifications. With -f flag, you can get format in full-length. To get customize the output, you can add -o flag to it.

Show Process Threads

Command Used: ps -p 4041 -L

Use -L flag to toggle on thread display to get any functionality of ps. This is used to track down the threads of a particular process.

Exhibit Results In The Form Of Hierarchical Tree

Command Used: ps -e –forest

It creates a tree-like structure to show processes. It displays forked & children processes as successors of the relevant processes. If you want to hide “branches” of the tree, replace –forest to -H


We are here and happy to help!


We will get back to you as soon as possible.


Live Chat

Speak online with our awesome client support.



Monday to Friday From 8am to 8pm IST.

+91 9555960648

Support Videos

Watch our online video and start quickly.


Have a question? Our team is here to help