netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch iproute2] ipaddress: add a black line for each device to make the output more readable
@ 2013-11-11 15:03 Hangbin Liu
  2013-11-11 15:08 ` Hangbin Liu
  2013-11-11 16:31 ` Jiri Benc
  0 siblings, 2 replies; 4+ messages in thread
From: Hangbin Liu @ 2013-11-11 15:03 UTC (permalink / raw)
  To: network dev; +Cc: Hangbin Liu

When we have multi links, the output huddled together and make it hard to read.
Let's use the old ifconfig output style.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 ip/ipaddress.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1c3e4da..9570f16 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -782,6 +782,7 @@ static int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo, FILE *
 
 		print_addrinfo(NULL, n, fp);
 	}
+	fprintf(fp, "\n");
 	return 0;
 }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch iproute2] ipaddress: add a black line for each device to make the output more readable
  2013-11-11 15:03 [patch iproute2] ipaddress: add a black line for each device to make the output more readable Hangbin Liu
@ 2013-11-11 15:08 ` Hangbin Liu
  2013-11-11 16:31 ` Jiri Benc
  1 sibling, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2013-11-11 15:08 UTC (permalink / raw)
  To: network dev

2013/11/11 Hangbin Liu <liuhangbin@gmail.com>:
> When we have multi links, the output huddled together and make it hard to read.
> Let's use the old ifconfig output style.

For example:

Before:
# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:10:18:f4:09:c4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.18.11/24 brd 192.168.18.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.100.1/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2012::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2001::210:18ff:fef4:9c4/64 scope global dynamic
       valid_lft 2086084sec preferred_lft 98884sec
    inet6 fe80::210:18ff:fef4:9c4/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:10:18:f4:09:c5 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:10:18:f4:09:c6 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:10:18:f4:09:c7 brd ff:ff:ff:ff:ff:ff
6: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
    link/ether 00:1b:21:a0:94:b6 brd ff:ff:ff:ff:ff:ff
    inet6 2001::21b:21ff:fea0:94b6/64 scope global dynamic
       valid_lft 2591897sec preferred_lft 604697sec
    inet6 fe80::21b:21ff:fea0:94b6/64 scope link
       valid_lft forever preferred_lft forever
7: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether e4:1f:13:eb:c4:1a brd ff:ff:ff:ff:ff:ff
    inet 10.66.86.93/23 brd 10.66.87.255 scope global eth5
       valid_lft forever preferred_lft forever
    inet 172.16.100.1/24 scope global eth5
       valid_lft forever preferred_lft forever
    inet6 2011::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2620:52:0:4257:e61f:13ff:feeb:c41a/64 scope global dynamic
       valid_lft 2086053sec preferred_lft 98853sec
    inet6 fe80::e61f:13ff:feeb:c41a/64 scope link
       valid_lft forever preferred_lft forever
8: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e4:1f:13:eb:c4:1b brd ff:ff:ff:ff:ff:ff
9: eth7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e4:1f:13:eb:c4:1c brd ff:ff:ff:ff:ff:ff
10: eth8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e4:1f:13:eb:c4:1d brd ff:ff:ff:ff:ff:ff


After:
# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether 00:10:18:f4:09:c4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.18.11/24 brd 192.168.18.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.100.1/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2012::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2001::210:18ff:fef4:9c4/64 scope global dynamic
       valid_lft 2086047sec preferred_lft 98847sec
    inet6 fe80::210:18ff:fef4:9c4/64 scope link
       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether 00:10:18:f4:09:c5 brd ff:ff:ff:ff:ff:ff

4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether 00:10:18:f4:09:c6 brd ff:ff:ff:ff:ff:ff

5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether 00:10:18:f4:09:c7 brd ff:ff:ff:ff:ff:ff

6: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
    link/ether 00:1b:21:a0:94:b6 brd ff:ff:ff:ff:ff:ff
    inet6 2001::21b:21ff:fea0:94b6/64 scope global dynamic
       valid_lft 2591860sec preferred_lft 604660sec
    inet6 fe80::21b:21ff:fea0:94b6/64 scope link
       valid_lft forever preferred_lft forever

7: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether e4:1f:13:eb:c4:1a brd ff:ff:ff:ff:ff:ff
    inet 10.66.86.93/23 brd 10.66.87.255 scope global eth5
       valid_lft forever preferred_lft forever
    inet 172.16.100.1/24 scope global eth5
       valid_lft forever preferred_lft forever
    inet6 2011::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2620:52:0:4257:e61f:13ff:feeb:c41a/64 scope global dynamic
       valid_lft 2086016sec preferred_lft 98816sec
    inet6 fe80::e61f:13ff:feeb:c41a/64 scope link
       valid_lft forever preferred_lft forever

8: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether e4:1f:13:eb:c4:1b brd ff:ff:ff:ff:ff:ff

9: eth7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether e4:1f:13:eb:c4:1c brd ff:ff:ff:ff:ff:ff

10: eth8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether e4:1f:13:eb:c4:1d brd ff:ff:ff:ff:ff:ff

>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>  ip/ipaddress.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 1c3e4da..9570f16 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -782,6 +782,7 @@ static int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo, FILE *
>
>                 print_addrinfo(NULL, n, fp);
>         }
> +       fprintf(fp, "\n");
>         return 0;
>  }
>
> --
> 1.8.1.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch iproute2] ipaddress: add a black line for each device to make the output more readable
  2013-11-11 15:03 [patch iproute2] ipaddress: add a black line for each device to make the output more readable Hangbin Liu
  2013-11-11 15:08 ` Hangbin Liu
@ 2013-11-11 16:31 ` Jiri Benc
  2013-11-12  2:09   ` Hangbin Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Benc @ 2013-11-11 16:31 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: network dev

On Mon, 11 Nov 2013 23:03:30 +0800, Hangbin Liu wrote:
> When we have multi links, the output huddled together and make it hard to read.
> Let's use the old ifconfig output style.

No. You can't break others' scripts like that.

bash$ function ip { /sbin/ip "$@" | sed '2,$s/^[0-9]*:/\n&/' ; }

^^^ Here, fixed that for you.

 Jiri

-- 
Jiri Benc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch iproute2] ipaddress: add a black line for each device to make the output more readable
  2013-11-11 16:31 ` Jiri Benc
@ 2013-11-12  2:09   ` Hangbin Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2013-11-12  2:09 UTC (permalink / raw)
  To: Jiri Benc; +Cc: network dev

On Mon, Nov 11, 2013 at 05:31:00PM +0100, Jiri Benc wrote:
> On Mon, 11 Nov 2013 23:03:30 +0800, Hangbin Liu wrote:
> > When we have multi links, the output huddled together and make it hard to read.
> > Let's use the old ifconfig output style.
> 
> No. You can't break others' scripts like that.

Hi Jiri,

Thanks for you reminding.

Although I think a blank line won't have much influence for most of strong
scripts, it MAY break some. But the output will be more readable. I think that
worth it.
> 
> bash$ function ip { /sbin/ip "$@" | sed '2,$s/^[0-9]*:/\n&/' ; }

Yes, this function works great. But for administrators who have lots of systems
and NICs, it's hard to add the function/alias on each system. And the output
of ifconfig, which is still used by lots of admins, looks clearly. So why
don't we also use it?

-- 

Thanks & Best Regards
Hangbin Liu <liuhangbin@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-12  2:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 15:03 [patch iproute2] ipaddress: add a black line for each device to make the output more readable Hangbin Liu
2013-11-11 15:08 ` Hangbin Liu
2013-11-11 16:31 ` Jiri Benc
2013-11-12  2:09   ` Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).