2

ps truncates output when standard output is a terminal to accommodate the terminal's width.

I see from ps --help output that ps supports --width and --lines options for controlling the screen width and height, respectively.

I find it awkward to specify a big arbitrary number like --width 1000, so is there some value or option that sets "unlimited" screen width?

root@controlplane:~# apt list --installed procps
Listing... Done
procps/now 2:3.3.12-3ubuntu1.2 amd64 [installed,local]

Extra: Is it possible to use search patterns with -C <cmd> to prevent having to type the cmd verbatim?

Example

root@controlplane:~# ps -f -C kubelet 
UID        PID  PPID  C STIME TTY          TIME CMD
root      9231     1  0 08:20 ?        00:00:07 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/
root@controlplane:~# ps -f -C kubelet | cat
UID        PID  PPID  C STIME TTY          TIME CMD
root      9231     1  0 08:20 ?        00:00:08 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.2

2 Answers 2

3

Doubling the -w option sets unlimited width:

ps -fww -C kubelet

ps itself doesn’t support pattern searches, but you can combine it with pgrep:

ps -fww -p $(pgrep -d, kubelet)

(This will produce an error if no processes match.)

2

A more general way to get wide output is:

env COLUMNS=2048 ps

or, make the output of ps not be a terminal:

ps | cat

This is very close to a Useless Use of cat.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .