Book Image

Linux Shell Scripting Essentials

Book Image

Linux Shell Scripting Essentials

Overview of this book

Table of Contents (15 chapters)
Linux Shell Scripting Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Listing and monitoring processes


In a running system, we often notice that suddenly a system is responding slowly. This can be because a running application is consuming a lot of memory or a process is doing CPU-intensive work. It's hard to predict which application is causing the system to respond slower. To know the reason, it is good to know what all processes are running and also know the monitoring behavior (such as the amount of CPU or memory being consumed) of processes.

Listing processes

To know a list of processes running in the system, we can use the ps command.

Syntax

The syntax of the ps command is as follows:

ps [option]

There are a lot of options to use the ps command. The commonly used options are explained in the following table.

Simple process selection

The following table shows the multiple options that can be clubbed together and used to get a better selection of results:

Option

Description

-A, -e

Selects all processes

-N

Selects all processes that don't fulfill a condition...