Re: w, who, finger, last, and netstat and ipv6
Hi Michael,
On Fri, Jul 22, 2016 at 11:57:32PM +0100, Michael Grant wrote:
> Why is it w, who, and finger truncate an ipv6 address just after the first
> 4 characters of the address (the first :)?
It isn't a great answer but I'm guessing the honest one is that it's
because they come from a time before IPv6 and may not have been
updated in the best way since then.
> % who
> mgrant   pts/1        2016-07-18 06:15 (2a00:S.1)
I type "who" on Debian jessie and I do get the full IPv6 address:
$ who
andy     pts/6        2016-07-23 01:42 (2001:ba8:1f1:f019::2)
$ who --version
who (GNU coreutils) 8.23
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.
> % w
>  18:37:31 up 4 days, 12:26,  4 users,  load average: 0.05, 0.07, 0.05
> USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
> mgrant   pts/1    2a00:S.1         Mon06    4days  0.02s  0.02s /bin/bash
Using the PROCPS_FROMLEN as documented in the man page, I can
increase the width of the "FROM" column:
$ PROCPS_FROMLEN=32 w
 01:46:09 up 97 days, 10:48,  6 users,  load average: 0.09, 0.08, 0.06
USER     TTY      FROM                             LOGIN@   IDLE   JCPU   PCPU WHAT
andy     pts/6    2001:ba8:1f1:f019::2             01:42    0.00s  0.16s  0.00s w
$ w --version
w from procps-ng 3.3.9
> %  finger
> Login     Name            Tty      Idle  Login Time   Office     Office
> Phone
> mgrant    Michael Grant   pts/1      4d  Jul 18 06:15 (2a00:S.1)
I don't have "finger" installed, so will leave investigation of that
one to someone else.
> The 'last' command does a little better, it truncates at 16 characters:
> 
> mgrant   pts/0        2a00:23c4:6d10:4 Fri Jul 22 18:04:00 2016   still
> logged in
Using the "-a" option to put the hostname/IP at the end does allow
it to be of arbitrary length:
$ last -a
andy     pts/6        Sat Jul 23 01:42   still logged in    2001:ba8:1f1:f019::2
> 
> netstat does a little better still but not much:
> 
> tcp6       0   2640 2600:3c00::ffff:9:22 2a00:23c4:6d10:4d:36663
> ESTABLISHED 12345/sshd: mgrant
"--wide" works for me.
$ netstat --protocol inet6 --wide
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp6       0    164 2001:ba8:1f1:f02c::2:ssh bitfolk.com:60756       ESTABLISHED
> This seems so basic.  Could all of these programs except tcpdump be broken
> with respect to displaying ipv6 addresses?
It didn't seem that hard to find this info from looking at the
relevant man pages…
Cheers,
Andy
-- 
http://bitfolk.com/ -- No-nonsense VPS hosting
Reply to:
- Prev by Date:
Re: [Gimp-user] Next gotcha
- Next by Date:
Re: w, who, finger, last, and netstat and ipv6
- Previous by thread:
w, who, finger, last, and netstat and ipv6
- Next by thread:
Re: w, who, finger, last, and netstat and ipv6
- Index(es):