Use column
. Por exemplo:
ss -anpt | column -t -x | less
Eu recebo a saída como:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 127.0.0.1:143 0.0.0.0:*
LISTEN 0 100 0.0.0.0:465 0.0.0.0:*
LISTEN 0 128 0.0.0.0:42449 0.0.0.0:*
LISTEN 0 10 0.0.0.0:5298 0.0.0.0:* users:(("pidgin",pid=30003,fd=19))
Nota: Eu executo um terminal com 282 colunas de largura (um terminal de largura máxima na minha tela 1440p com Liberation Mono Regular 11). YMMV em terminais mais estreitos.
column
realiza uma tarefa semelhante, mas não idêntica, ao programa columns
do autogen
. Ele faz um bom trabalho de formatação automática de texto em colunas tabuladas.
Não tenho certeza de onde veio a origem original de column
, mas nos sistemas da Debian, está no pacote bsdmainutil
. Pode estar em um pacote com nome similar em outras distribuições Linux.
Package: bsdmainutils
Version: 11.1.2
Description-en: collection of more utilities from FreeBSD
This package contains lots of small programs many people expect to find when
they use a BSD-style Unix system.
.
It provides banner (as printerbanner), calendar, col, colcrt, colrm, column,
from (as bsd-from), hexdump (or hd), look, lorder, ncal (or cal), ul, and
write (as bsd-write).
.
This package used to contain whois and vacation, which are now distributed in
their own packages. Also here was tsort, which is now in the "coreutils"
package.
O arquivo /usr/share/doc/bsdmainutils/copyright
no pacote diz:
This is a collection of programs from 4.4BSD-Lite that have not (yet) been re-written by FSF as GNU. It was constructed for inclusion in Debian Linux. As programs found here become available from GNU sources, they will be replaced.
e
This package may be redistributed under the terms of the UCB BSD license:
Copyright (C) 1980 -1998 The Regents of the University of California. All rights reserved.