pstree - manage your running services!

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
viking60
Über-Berserk
Posts: 9213
Joined: 14 Mar 2010, 16:34

pstree - manage your running services!

Postby viking60 » 13 Aug 2016, 13:35

:tux5: We have the ps command that can tell us a lot about our running services. If we want to show the entire enchilada we can type:

Code: Select all

ps aux


And that will show a lot! It is probably a loong list. a stands for all u shows more details and x for showing all processes that are not assigned to a TTY.

You can use grep and specify but there is a better and faster way to get an overview of your running services:

Code: Select all

pstree


This will show your running processes in the shape of a tree:
:A
Image


In Centos 7 I had to install psmisc first because it is not there after a minimal install.

You can specify a lot like adding command line info with

Code: Select all

 pstree -a
Maybe you need the PID (Process ID) too? No problem:
:A

Code: Select all

pstree -p


You may also view all processes that are initiated by you or root like this:

Code: Select all

pstree viking
or

Code: Select all

pstree root


pstree lists by alphabetical order as default and it is great for getting a quick overview over what is going on when you come to a new Linux PC.

There are lot of options so check the man page.

To get a quick overview you can also use programs like Glances or Atop

Pstree presents the running processes in a tidy manner.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

Return to “Tips & Tricks”