Black Friday Deals for Linux Users are Now Live!
Learn more
Nov 13, 2022 3 min read

How to Show Process Tree in Linux

Table of Contents

So you used the killall command and it killed the parent process making your hours of work at waste?

Well, I went through the same so it is always a better idea to check the parent processes, and listing the ongoing processes in tree manner is a good idea.

Use the ps command to show the process tree

The ps command in Linux is used to find ongoing processes in Linux and it also avails you to print the exact info in a tree manner.

You can use the --tree option to show the process tree with the ps command:

ps -ef --forest
use ps command in linux


  • -e is used to select every process.
  • -f gets details in full format.

Use the pstree command to show the process tree

Personally, this is what I prefer to have as even without any options, it works fine.

But your distro may not have it pre-installed and if you're on Ubuntu-based distros, the given command should do it:

sudo apt install psmisc

Now, you can simply use the pstree command and it should give you the following output:

use pstree command in linux

Similarly, you can use -p option to get process IDs:

pstree -p
show process id in pstree command

Use the tree command to show the process tree

While the tree command is mainly used to list files recursively, you can look at /proc to get the process tree.

But it requires manual installation as it does not come pre-installed and if you're on an Ubuntu-based distro, the following command should do it:

sudo apt install tree

Now, you can use the given command to show the process tree:

tree /proc
use tree command to show process tree

It showed 23665 directories and 435044 files which bloated my terminal window and you can limit the info using -d option as it will only show directories:

tree -d /proc
limit tree command output to directories only

And if you want to have full pathnames, you can use -f option:

tree -f /proc
get full pathnames in tree command

Use the htop utility to show the process tree

htop is similar to the top command. And in my opinion, this is arguably the most interactive way of checking ongoing processes in the terminal.

But what if I tell you that it is also capable of showing a process tree too? But before that, let's head over to the installation part.

It does not come pre-installed and if you are on an Ubuntu-based distro, the given command should do it:

sudo apt install htop

Once you are done with the installation, use the given command to start htop:

use htop in linux to show ongoing processes

Now, you just have to press F5 and the ongoing process will be shown to you in tree format:

show process tree in linux using htop

Wrapping Up

One practical example of displaying the process tree is in checking whether your system uses systemd or not.

This was my take on how you can show the process tree using various utilities but there is a lot more you can do with those utilities. More on them later.

To learn more, you can always use the man page to make the most out of utilities.

Linux Foundation Training
Sagar Sharma
A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Linux Handbook.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.