Tuesday 19 November 2019

How to Use the ps Command to Monitor Linux Processes

A terminal window on a Linux laptop.
Fatmawati Achmad Zaenuri/Shutterstock

Get a snapshot of the processes running in your Linux computer with the ps command. Locate processes by name, user, or even terminal with as much or as little detail as you need. We show you how.

Process Management on Linux

The beating heart of all Linux and Unix-like operating systems is the kernel. Amongst its many responsibilities is the allocation of system resources such as RAM and CPU time. These have to be juggled in real-time so that all running processes get their fair share, according to the priority of each task.

Sometimes tasks can lock-up, or enter a tight loop, or become unresponsive for other reasons. Or they may continue running, but gobble up too much CPU time or RAM, or behave in some equally anti-social way. Sometimes tasks need to be killed as a mercy to everyone involved. The first step. Of course, is to identify the process in question.

But maybe you don’t have any task or performance issues at all. Perhaps you’re just curious about which processes are running inside your computer, and you’d like to peek beneath the hood. The ps command satisfies both of these needs. It gives you a snapshot of what is happening inside your computer “right now.”

ps is flexible enough to give you precisely the information you need in exactly the format you’d like it. In fact, ps has a great many options. The options described here will cater for most commonplace needs. If you need to go deeper into ps than we’ve taken it in this article, you’ll find that our introduction makes the man page easier to digest.

Listing Processes

The easiest way to use ps is to fire it up with no parameters:

ps

ps in a terminal window

ps displays a list of the processes started by the user who ran the command.

output from ps in a terminal window

Read the remaining 96 paragraphs



from How-To Geek https://ift.tt/35kKuoB

No comments:

Post a Comment