In the command "ps ax -o pid,args" the PID is run together with the next field whenever the PID is longer than 5 characters. Easy demonstration with alpine linux in a docker container: $ docker run -it alpine:latest / # for n in $(seq 100000); do (:) ; done / # ps ax -o pid,args PID COMMAND 1 /bin/sh 100008ps ax -o pid,args I also built the current master branch on my local ubuntu box and reproduced: (Create processes to get PID above 100000, then...) $ ./busybox ps ax -o pid,args PID COMMAND ... 102096busybox ps ax -o pid,args Standard: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html ... -o format Write information according to the format specification given in format. This is fully described in the STDOUT section. Multiple -o options can be specified; the format specification shall be interpreted as the <space>-separated concatenation of all the format option-arguments.
commit 3106784e654e7443ab724d927f9de0230adbe5ac Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Fri May 3 09:49:56 2019 +0200 ps: ensure fields are separated by at least one space, closes 11826 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> diff --git a/procps/ps.c b/procps/ps.c index 54e6c40fc..815c11578 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -533,7 +533,7 @@ static void format_process(const procps_status_t *ps) len = out[i].width - len + 1; if (++i == out_cnt) /* do not pad last field */ break; - p += sprintf(p, "%*s", len, ""); + p += sprintf(p, "%*s", len, " "); /* " ", not "", to ensure separation of fields */ } printf("%.*s\n", terminal_width, buffer); }