Home » Linux » Tips » Linux List Processes

List Running Processes in Linux with ps, top, or htop

This article will show you how to list running processes in Linux using several tools. This will allow you to see what is running and how your system resources are being consumed.

It’s helpful to see what resources are in use by what process to diagnose slow systems. This information can be used to determine whether you need to purchase more memory (RAM), a faster processor, or whether an application or service on your computer is misconfigured and using more resources than it should.

What is a Process?

process is an application running on your system. It could be a web browser that you can see running on your desktop, or it could be a file server running in the background that isn’t something with which you generally interact directly.

Processes consume resources – memory and processing time (as well as storage and networking resources if the application requires them), which they use to perform whatever task they were written to do.

The below commands list these running processes and the resources which they are using.

The ps Command

The ps (Process Status) lists the status of running processes (funnily enough). Run it with the default options by executing:

ps

By default, ps will list processes for the current terminal session – it will not show processes from other sessions or other users other than the one currently logged in.

To view all running processes for user users on the system:

ps aux

The aux option combines several options – a to show processes for all users, u to output additional info like CPU and memory usage, and x to list background processes not executed from the terminal.

You can view the full user manual for the ps command by running:

man ps

The top Command

The top command can be used to find resource-hungry processes – it provides an automatically updated display with processes in order of how much of the system resources they are using up.

Simply run:

top

To run it.

Rather than passing options to top, when top is running, you can press various keys on the keyboard to change how the data is displayed and sorted on the screen.

Hotkey
c Display the absolute path to the processes executable
d Changes the refresh interval – the rate at which the top screen is updated
h Show help
k Kill process
M Sorts by memory usage
N Sorts by PID (Process ID)
r Changes the process priority
z Displays process list in color
q Quit

Watch out! The above commands are case-sensitive.

Some of these commands may not be supported on your system if you are not running as root or using the sudo command.

You can view the full user manual for the top command by running:

man top

The htop Command

htop is just like the top command, but it has some extra features to make it easier to use.

You can scroll around to view the full list or use the mouse to navigate.

htop may not be installed by default in your Linux distribution.

If you’re on Ubuntu, it can be quickly installed by running:

sudo apt install htop

…and most other Linux distributions should have htop available in their package repositories.

Once installed, simply run:

htop

…to launch htop. Like top, it contains keyboard shortcuts to navigate, sort, and manage the running processes:

Hotkey
F1 Show help
F2 Show setup
F3 Search
F4 Filter processes by name
F5 Display tree view
F6 Sort processes by column
F7 Decrease process priority
F8 Increase process priority
F9 Kill process

You can view the full user manual for the htop command by running:

man htop

 

SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment