aumentando ps -o largura da coluna

4

Quando eu executo o comando

ps -e -o cmd,stime,etime=

o cmd comlumn é truncado, para que o caminho cmd seja truncado. Como faço para formatar a largura da coluna para que todo o texto seja exibido?

    
por category 30.09.2016 / 16:55

2 respostas

5

No GNU / Linux, você pode definir a largura da coluna da seguinte forma:

ps -e -o cmd:50,stime,etime=

Na página de manual ps (1) :

-o format

User-defined format. format is a single argument in the form of a blank-separated or comma-separated list, which offers a way to specify individual output columns. The recognized keywords are described in the STANDARD FORMAT SPECIFIERS section below. Headers may be renamed (ps -o pid,ruser=RealUser -o comm=Command) as desired. If all column headers are empty (ps -o pid= -o comm=) then the header line will not be output. Column width will increase as needed for wide headers; this may be used to widen up columns such as WCHAN (ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm). Explicit width control (ps opid,wchan:42,cmd) is offered too. The behavior of ps -o pid=X,comm=Y varies with personality; output may be one column named "X,comm=Y" or two columns named "X" and "Y". Use multiple -o options when in doubt. Use the PS_FORMAT environment variable to specify a default as desired; DefSysV and DefBSD are macros that may be used to choose the default UNIX or BSD columns.

    
por 30.09.2016 / 16:58
0

No Ubuntu 18.04, o comando:

ps -eo comm:25,pid

de fato amplia a coluna COMMAND, mas não interrompe o truncamento, mesmo em comandos com menos de 25 caracteres:

gsd-printer                2384 
gvfsd-trash                2397
evolution-calen            2401
ibus-engine-sim            2429
dconf-service              2436
evolution-calen            2445
evolution-addre            2457
evolution-addre            2468
fwupd                      2488
    
por 01.10.2018 / 18:16