Column widths FROM / WHAT in w(1)

Christian Barthel bch at online.de
Thu Apr 11 09:09:30 UTC 2019


Polytropon <freebsd at edvax.de> writes:

> Any idea on how to get the old layout of w back, instead
> of increasing the terminal width?

w(1) is using ioctl's to determine the column width of the
terminal.  Other tools like ps (-w) and top can be configured to
change the column width.  On Linux, it seems that the variable
COLUMN allows overriding it.

Attached is a small patch that would add an environment check on
the COLUMN variable.  Further processing would be possible then,
like: 
 
# COLUMN=180 ./w |sed 1d| cut -c 76-            
WHAT
tmux: client (/tmp//tmux-1000/default) (tmux)
cut -c 76-
-tcsh (tcsh)

I am not sure if there is another way to change the perceived
column width in w(1).

-- 
Christian Barthel <bch at online.de>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: column_in_w.patch
Type: text/x-diff
Size: 869 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20190411/06176bb7/attachment.patch>


More information about the freebsd-questions mailing list