Colulmn width of "top" entries

mahmood asked:

The username column in the output of top command shows a + for the names that are longer than the column width. How can I increase that?

I don’t see any option for that.

My answer:


Interesting; there is a way to do it. While running top, use the Shift+X interactive command to widen various fixed-width columns. Giving a parameter of 5 will, for instance, add 5 characters to the USER field, for a total of 13 characters. This ought to display the entire username for most users.

For example:

Before:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
 8736 nm-open+  20   0   74744   7872   6868 S   0.3  0.0   1:28.93 openvpn     

Press Shift+X and enter 5:

width incr is 0, change to (0 default, -1 auto) 5

After:

  PID USER           PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ 
 8736 nm-openvpn     20   0   74744   7872   6868 S   0.4  0.0   1:29.04 

You should resize your terminal to be wider than 80 characters before doing this, or you’ll lose information.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.