SSH – How to get `yum list` output to stay on one line when getting output via remote ssh command

pipesshterminalyum

When I SSH to a machine with ssh machine and run yum list it outputs everything that's installed as expected, and importantly every item is on one line like so:

xz-devel.i386                                                                                                        4.999.9-0.3.beta.20091007git.el5                                                                  base            
xz-devel.x86_64                                                                                                      4.999.9-0.3.beta.20091007git.el5                                                                  base            
xz-libs.i386                                                                                                         4.999.9-0.3.beta.20091007git.el5                                                                  base            
xz-lzma-compat.x86_64                                                                                                4.999.9-0.3.beta.20091007git.el5                                                                  base            

But upon doing it remotely with ssh machine 'yum list' or even piping it to grep while on the server with yum list | grep xz -C 3 the output's lines are "truncated" and made much shorter, like so:

xz-devel.i386                              4.999.9-0.3.beta.20091007git.el5
                                                                       base     
xz-devel.x86_64                            4.999.9-0.3.beta.20091007git.el5
                                                                       base     
xz-libs.i386                               4.999.9-0.3.beta.20091007git.el5
                                                                       base     
xz-lzma-compat.x86_64                      4.999.9-0.3.beta.20091007git.el5
                                                                       base     

How can I make the size of the line not shrink like this? My end desire is to pipe this to tee and then do some processing on the outputted file for all my hosts via ansible.

It seems that this is occurring due to some sort of "virtual terminal" as part of the SSH/piping because I can get the same behavior if I shrink my terminal size where the lines break when running yum list. Thus I'd assume that the addition of the pipe somehow tells yum list that the width of the terminal is only X columns

Best Answer

Per this answer provided in the comments by @thrig I was able to get it to output correctly by doing

yum list installed | xargs -n3 | column -t 
Related Question