View process hierarcy from the command line - pstree

The commands ps and top are very useful for seeing what's running on your system. Operating systems like Linux though actually have a hierarchical system of processes, and by default neither of those two show you that hierarchy.

That's where pstree comes in. As the name suggests, it shows you a tree-style list of processes in this hierarchy. As you can see, depending on the exact flavour of Unix you're running, there might be a different name, but there will be a 'father' process that is right at the top.

pstree

In the case of Linux, that's init. You'll notice that in your output, all processes are underneath this one. You might also discover some interesting relationships between different processes.

It also might turn out useful if something goes awry on your system and if you need to identify the root culprit of a problem (for example if the parent process spawns a child which locks up).

Whether it's out of sheer curiosity, to troubleshoot, or for something else, pstree is a useful tool to have in your command line toolkit.

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: View process hierarcy from the command line - pstree

  1. # Posted on 07 September 2007 at 10:22 PM

    [...] Vía | FOSSwire [...]



Home » Articles » View process hierarcy from the command line - pstree