PSTREE(1)

๐Ÿ“ฆ
version 23.7 ยท 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐ŸŒธ PSTREE(1) ๐ŸŒธ

Okay bestie, this is the pstree manual page, from the User Commands section. It's giving tree-shaped process vibes ๐ŸŒณ๐Ÿ’–

๐Ÿฆ‹ NAME

pstree โ€” display a tree of processes โœจ

๐Ÿ’… SYNOPSIS

pstree [-a, --arguments] [-c, --compact-not] [-C, --color attr]
[-g, --show-pgids] [-h, --highlight-all, -H pid, --highlight-pid pid]
[-l, --long] [-n, --numeric-sort] [-N, --ns-sort ns] [-p, --show-pids]
[-s, --show-parents] [-S, --ns-changes] [-t, --thread-names]
[-T, --hide-threads] [-u, --uid-changes] [-Z, --security-context]
[-A, --ascii, -G, --vt100, -U, --unicode] [pid, user]
pstree -V, --version

โœจ DESCRIPTION โœจ

okay so pstree shows your running processes as a tree ๐ŸŒณ The tree is rooted at either pid, or at init if you leave pid out. If you give it a user name, you get every process tree rooted at a process that user owns ๐Ÿซถ

pstree lowkey merges identical branches. It puts them in square brackets and adds the repetition count in front. For example:

    init-+-getty
         |-getty
         |-getty
         `-getty

becomes

    init---4*[getty]

Child threads of a process hang out under the parent process and show up with the process name in curly braces, like this:

    icecast2---13*[{icecast2}]
๐Ÿ™ˆ If you call it as pstree.x11, it will ask you to press return at the end of the line, and it won't come back until you do. This is handy when you run it in a xterminal.

Some kernel or mount parameters, like the hidepid option for procfs, hide info for certain processes. When that happens, pstree tries its best to build the tree without that info, and shows the process names as question marks ๐Ÿคทโ€โ™€๏ธ

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -a, --arguments โ€” show the command line arguments ๐Ÿ“œ If a process's command line has been swapped out, that process gets shown in parentheses. -a also turns off compaction for processes, but not for threads.
  • -A, --ascii โ€” draw the tree with ASCII characters ๐Ÿ”ค
  • -c, --compact-not โ€” turn off compaction of identical subtrees ๐Ÿ™…โ€โ™€๏ธ By default, subtrees get compacted whenever it's possible.
  • -C, --color attr โ€” color the process name based on the attribute you give ๐ŸŒˆ Right now the only value pstree accepts is age, which colors by how old the process is. Processes younger than 60 seconds are green, ones newer than an hour are yellow, and everything else is red.
  • -g, --show-pgids โ€” show the PGIDs ๐Ÿ“ Process Group IDs appear as decimal numbers in parentheses after each process name. If you show both PIDs and PGIDs, the PIDs come first.
  • -G, --vt100 โ€” draw with VT100 line drawing characters ๐Ÿงš
  • -h, --highlight-all โ€” highlight the current process and its ancestors โœจ This does nothing if your terminal can't highlight, or if neither the current process nor any of its ancestors are in the subtree being shown.
  • -H pid, --highlight-pid pid โ€” same vibe as -h, but you get to pick the process to highlight ๐ŸŽฏ Unlike -h, pstree fails when you use -H and highlighting isn't available.
  • -l, --long โ€” display long lines ๐Ÿ“ By default, lines get truncated to either the COLUMNS environment variable or the display width. If neither of those works, it falls back to 132 columns.
  • -n, --numeric-sort โ€” sort processes with the same parent by PID instead of by name ๐Ÿ”ข (Numeric sort, periodt.)
  • -N ns, --ns-sort ns โ€” show separate trees for each namespace of the type you pick ๐Ÿชž The available types are: ipc, mnt, net, pid, time, user, uts. Regular users can't see other users' process info, so the output will be limited for them ๐Ÿ’€
  • -p, --show-pids โ€” show the PIDs ๐Ÿ” PIDs appear as decimal numbers in parentheses after each process name. -p also turns off compaction.
  • -s, --show-parents โ€” show the parent processes of the specified process ๐Ÿ‘‘
  • -S, --ns-changes โ€” show namespace transitions ๐Ÿ”„ Just like -N, the output is limited when you run it as a regular user.
  • -t, --thread-names โ€” show full names for threads when they're available ๐Ÿงต
  • -T, --hide-threads โ€” hide threads and only show processes ๐Ÿซฅ
  • -u, --uid-changes โ€” show uid transitions ๐Ÿชช Whenever a process's uid is different from its parent's uid, the new uid shows up in parentheses after the process name.
  • -U, --unicode โ€” draw with UTF-8 (Unicode) line drawing characters ๐Ÿ’œ On Linux 1.1-54 and above, UTF-8 mode gets switched on at the console with echo -e ' 33%8' and switched off with echo -e ' 33%@'.
  • -V, --version โ€” display version information ๐ŸŽ‰
  • -Z, --security-context โ€” show the current security attributes of the process ๐Ÿ›ก๏ธ On SELinux systems, this is the security context.

๐Ÿ—‚๏ธ FILES

  • /proc โ€” where the proc file system lives ๐Ÿ“

๐Ÿ› BUGS

๐Ÿ’€ Some character sets may not play nicely with the VT100 characters.

๐Ÿซถ SEE ALSO

ps(1), top(1), proc(5).


That's the tea, bestie ๐Ÿ’– pstree is from the psmisc package, dated 2021-06-21, and it's PSTREE(1) forever โœจ๐Ÿฆ‹๐Ÿ‘‘