Linux ps Command Tutorial List Processes with Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-ps-command-tutorial-list-processes-examples/
PINTEREST
PINTEREST
INSTAGRAM

Processes are the one of the main parts of the operations systems. All user side even kernel side operations are executed with process. Process generally created, run and killed. This life cycle of the process generally the same. During this life cycle we may need to get more information about processes. ps command is most used command to list and get information about processes.

List Current User Processes

Process can be listed without providing any option to the ps command. But this will only list current users processes and do not list other system, user or root user processes.

List Current User Processes

List Current User Processes

BSD Syntax

ps command is very universal tool. ps also used other Unix variant operations systems. BSD provides options without - dash. So there is generally no difference but knowing BSD Syntax is beneficial. Following example uses BSD syntax.

List All Process

In previous steps we have listed the processes running on the Linux system just for current user. But generally we need to list all processes in a single shot. We can provide the -ax options in order to list all processes.

List All Process

List All Process

List Processes As Tree

In previous example we have printed all processes in list format. There is alternative presentation format named Tree. Tree format is an hierarchical format which will provide visual information about parent and child relationship.

List Processes As Tree

List Processes As Tree

List Process Info

While listing processes we can print more information about process. We will use -u option for this detailed information.

LEARN MORE  How To Get Cpu Info and Number of Cpus In Linux?

List Process Info

List Process Info

List Only Specific Named Process

While listing processes we may need to filter according to process or command name. Here we will use -C parameter and process name for filter operation.

List Only Specific Named Process

List Only Specific Named Process

Print Only Specific PID Process

Another way to filter processes id according to their PID. We can filter by given their PID. We will use the -p option and PID’s in order to filter.

In this example we will filter multiple processes according to their IP address.

Print Only Specific PID Process

Print Only Specific PID Process

Print Only Specific User Processes

Another useful filtering mechanism is filtering processes according to their owners or users. We will use -u option and username to filter.

In this example we want to filter username ismail .

Display Threads of Process

As we know Linux provides threads to make processes more efficient. Threads are create under the processes and completes given work by parent process. We will use --ppid option in order to list child threads.

Sort Process According To Cpu Usage

While list process by default they are sorted with their PID’s. There is alternatives to sort processes. We can sort processes according t their current CPU usage with --sort=pcpu option like below.

Sort Process According To Memory Usage

We can also sort processes according to their memory usage with --sort=pmem command like below.

LEARN MORE  For Loops In Windows With MS-DOS Command Propmpt

Run Ps Real Time Mode

The default behavior of ps command is running and exiting. ps command can be run in real time without exiting. This is same as top command. We will use an external command named watch and provide the ps command.

In this example we will list processes in 2 second intervals.

Run Ps Real Time Mode

Run Ps Real Time Mode

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-ps-command-tutorial-list-processes-examples/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

1 Response

  1. 16/06/2017

    […] Search linux ps Linux ps Command Tutorial List Processes with Examples […]

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)