I am trying to run top
with multiple PIDs using -p
option and xargs
. However, top
fails to run with error top: failed tty get
:
$ pgrep gvfs | paste -s -d ',' | xargs -t top -p
top -p 1598,1605,1623,1629,1635,1639,1645,1932,2744
top: failed tty get
I used the -t
option for xargs
to see the full command which is about to be executed. It seems fine and I can run it successfully by hand:
top -p 1598,1605,1623,1629,1635,1639,1645,1932,2744
However, it does not run with xargs
. Why is that?