Display Linux process tree, using ps command



Configuration for GNU Linux Fedora Computer using Linux Command

 

    The ps command also can be use to display process tree.  The ps command example below, show step to use and ps command option to display Linux process in tree look alike view.  The below process tree command example, taken from Fedora Linux system.

ps command and the ps option that need to print a process tree:

# ps -ejH

# ps axjf

 

ps -ejH command example:

The Linux process show in tree

[root@fedora ~]# ps -ejH

PID PGID SID TTY TIME CMD

2 0 0 ? 00:00:00 kthreadd

3 0 0 ? 00:00:00 migration/0

4 0 0 ? 00:00:00 ksoftirqd/0

5 0 0 ? 00:00:00 watchdog/0

...............

3106 2263 2263 ? 00:00:02 gnome-screenshot

[root@fedora ~]#

 

ps axjf command example:

View Linux process tree with ps command ps axjf

[root@fedora ~]# ps axjf

PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND

0 2 0 0 ? -1 S< 0 0:00 [kthreadd]

2 3 0 0 ? -1 S< 0 0:00 \_ [migration/0]

2 4 0 0 ? -1 S< 0 0:00 \_ [ksoftirqd/0]

2 5 0 0 ? -1 S< 0 0:00 \_ [watchdog/0]

...............

1 1944 1944 1944 ? -1 Ss 0 0:00 /usr/sbin/sshd

1944 2702 2702 2702 ? -1 Ss 0 0:02 \_ sshd: root@pts/1

2702 2708 2708 2708 pts/1 3057 Ss 0 0:00 | \_ -bash

2708 3057 3057 2708 pts/1 3057 S+ 0 0:00 | \_ man ps

3057 3061 3057 2708 pts/1 3057 S+ 0 0:00 | \_ sh -c (

3061 3062 3057 2708 pts/1 3057 S+ 0 0:00 | \_ sh

3062 3067 3057 2708 pts/1 3057 S+ 0 0:00 | \_

...............

1 3055 2263 2263 ? -1 Sl 0 0:01 gnome-screenshot --wind

3055 3106 2263 2263 ? -1 S 0 0:02 \_ gnome-screenshot --

[root@fedora ~]#

 

Make note that the actual ps command above show lots more information than show in this article.

 




0 comments: