Feature #11963


Allow ptree(1) to wrap output

Added by Jason King over 4 years ago. Updated over 4 years ago.

cmd - userland programs
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:
External Bug:


Currently ptree(1) truncates its output so each line doesn't exceed the width of the terminal. This can be undesired at times where the longer cmdline is wanted.
Add a '-w' option to allow the ptree(1) output to wrap in the current terminal.

Actions #1

Updated by Jason King over 4 years ago

Just to note: this will still be subject to the size of PSARGSZ (i.e. it'll output at most 80 bytes of actual content).

Even on a standard 80-column wide terminal window, it's fairly easy for even lightly nested hierarchies to result in truncating the output, requiring the user to resize their terminal (if possible) and re-run the command, or then go back and run pargs on each process. This is really obnoxious when multiple processes are present that only differ in the last few arguments and the distinguishing pieces are truncated as is often the case when multiple scripts using the same interpreter (e.g. node) are running.

Actions #2

Updated by Electric Monk over 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit f21abddf5629122d5dd1aa759e5ec0f27610c188

commit  f21abddf5629122d5dd1aa759e5ec0f27610c188
Author: Jason King <>
Date:   2019-11-14T22:00:52.000Z

    11963 Allow ptree(1) to wrap output
    Reviewed by: Andrew Stormont <>
    Reviewed by: Andy Fiddaman <>
    Approved by: Dan McDonald <>

Actions #3

Updated by Joshua M. Clulow over 4 years ago

Testing Notes (from Jason)

To test, I build the updated version of ptree(1). I then compared the output of various invocations (-g,-c) with then adding the -w flag (-gw, -cw) as well as compare to the unmodified ptree command. As expected, when either the unmodified or modified binary was run without the -w flag, the output was unchanged (and truncation of output lines occurred). When the patched binary was run with the -w flag, truncation did not occur (i.e. the entire contents of psargs was displayed).

In addition, I viewed the updated man page and verified the additions for the -w flag were there and looked correct.


Also available in: Atom PDF