How to display output of multiple commands using columns

Use paste utility to merge lines using tab character as delimiter, expand to convert tabs to spaces and column to format input into multiple columns.

unifi controller
Two columns displaying output of multiple commands

Display some basic system information and some random Debian related epigram.

$ paste <(printf "Hostname: $(hostname)\nDate: $(LC_ALL=C date)"; printf "\n\n"; printf "Memory:\n"; head -4 /proc/meminfo) \
        <(printf "\n\n\n";LC_ALL=C df -h -x tmpfs -x devtmpfs) \
        <(printf "\n";fortune debian-hints | expand -t 8)  | \
  column -s $'\t' -tne
Hostname: milosz-XPS-13-9343                                                                       
Date: Tue Feb  6 21:39:04 CET 2018                                                                 Debian Hint #13: If you don't like the default options used in a Debian
                                                                                                   package, you can download the source and build a version which uses the
Memory:                             Filesystem                   Size  Used Avail Use% Mounted on  options you prefer. See http://www.debian.org/doc/FAQ/ch-pkg_basics.html
MemTotal:        8059088 kB         /dev/mapper/debian--vg-root  226G   90G  126G  42% /           (sections 6.13 and 6.14) for more information.
MemFree:         1338300 kB         /dev/sda2                    473M  336M  114M  75% /boot       
MemAvailable:    3353428 kB         /dev/sda1                    511M  4.7M  507M   1% /boot/efi   However, bear in mind that most options in most packages can be configured
Buffers:          233632 kB                                                                        at runtime, and do not require recompiling the package.

Display some basic system information and a nice ascii art.

$ paste <(fortune mario.arteascii | expand -t 8) \
        <(printf "Hostname: $(hostname)\nDate: $(LC_ALL=C date)"; printf "\n\n"; printf "Memory:\n"; head -4 /proc/meminfo; printf "\n\n";LC_ALL=C df -h -x tmpfs -x devtmpfs) | \
  column -s $'\t' -tne
                                             Hostname: milosz-XPS-13-9343
             ..ooooox.                       Date: Tue Feb  6 22:22:49 CET 2018
        [email protected]@@XXX%xx..                     
     [email protected]@XXX&x&xxx...                      Memory:
   [email protected]%%xx..                   ...         MemTotal:        8059088 kB
   [email protected]%x.                    ..oXXXoooo.     MemFree:          404848 kB
 [email protected]%x.                  [email protected]^^      ^^@X.   MemAvailable:    2913868 kB
[email protected]@@@@@@ooo..      [email protected]@^           @X%   Buffers:          242820 kB
[email protected]@^^^     ^^^@@@[email protected]@^   *          %x.  
[email protected]          *   ^.  .                  .%^  
 .o.            [email protected] [email protected]  .. oox.     .X%.   Filesystem                   Size  Used Avail Use% Mounted on
 [email protected]     .    %[email protected]@   @o.     ^^[email protected]@@^    /dev/mapper/debian--vg-root  226G   90G  125G  42% /
  [email protected]  .xxx     [email protected]@^   ^@%%o..   [email protected]@^      /dev/sda2                    473M  336M  114M  75% /boot
   [email protected]@XX%      .x%@   .  @xxo^..             /dev/sda1                    511M  4.7M  507M   1% /boot/efi
     ^XX%%^  [email protected]@X %  XXx @@^x%..             
            [email protected]@XX%xx.. ^^XX%%xx...          
           .oXXxx...                         
           [email protected]@@xxoo..                     
          .x%. [email protected]                    
          .x^  ^X^ [email protected]                    
           ^    '   [email protected]                     
           '          ^.                     
kalev kaarna - benkalev at ut.ee             

There are at least a couple of possible use cases involving this method, mostly informative ones.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.