Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The ip command has a built-in help system you can get started with "ip help", but it tends to throw a lot of fugly BNF at you and is pretty light on detail.

The ip manpage is much better. It is broken up into sections which is a bummer for searching but does make it a little less daunting for reading.

The nice thing about it is that since it has been around for many years now you can google search most any question and find the answer. All in all the ip command is fairly straightforward and orthogonal which is nice.

Some starting commands

"ip addr show" lists interfaces and their stats. It's harder to read than ifconfig -a but gives you the same information in a similar format.

"ip route show" replaces netstat -rn to show the routing table but is also not as well formatted as the old command.

"ip neigh show" replaces arp -a and is about the same level of legibility.

"ip route add ..." replaces "route ..." command and is about the same to use.

So basically it combines a bunch of commands (including ifconfig) into one and gives them all a unified interface.



>"ip addr show" lists interfaces and their stats. It's harder to read than ifconfig -a but gives you the same information in a similar format.

It's worth noting that `-br` gives you a brief version of the output, and `-c` colors it, so that it's possible to do something like this:

  ip -br -c addr
to get a very readable and colorful table-like output.

There's also `-j` for JSON, and `-j -p` for pretty JSON.


ip is way more useful than your summary! It also supports abbreviations just like a switch does which is nice:

  $ip a
  $ip a a 10.99.0.111/24 dev re0
  $ip r
  $ip r a default via 10.99.0.1 dev re0
The second command is: ip address add. The third is show me the routing table - ip4 is the default add -6 for ipv6. The fourth is add a default route.

  $ip n s
That is neigh(bour) show - the arp table.

On Linux, ipconfig and co are destined to quietly go away. Use ip and co instead - so much more powerful.


The abbreviation convention on networking gear isn’t a good thing. It allows for typos to become completely different command, thus introducing unexpected behaviour. I’ve heard so many horror stories (and had some of my own too) because of this.


I don't agree with you. It is a convenience but you do need to be careful. There are few (if any) commands that can be morphed into another to cause horror. All switch command completers I know of will not complete on ambiguity.

If you feel you are personally a bit random then use the try/commit mode that most decent gear allows. You package up a set of changes and try them out. You then commit them within an agreed time or the changes revert.


As I said, I’ve personally been bit by feature and know of others who have. So I’m not talking about a theoretical risk.

Things might have improved since I was last managing Cisco gear. try/commit wasn’t available back then and maybe those stupid commands (like “administrator-full-port-shutdown”) have been since removed to prevent ambiguous shortenings. But I did quickly learn that it’s better to be explicit rather than implicit. And frankly, I still think that’s good advice given the IaC methodologies that are now commonly practiced. If nothing else, you should be writing your config so that others can read it, and storing that config in version control.


There's some caveats to comparing it to linux ifconfig and netstat:

ifconfig can't express the idea that an interface can have IPv4 address, and is inconsistent with itself because it does show all of the IPv6 addresses.

netstat (and route because you can't manipulate the main RIB with netstat, so now you have two problems-- er-- tools) completely elides things like source address selection as a function of the RIB, and the fact that the kernel can have more than one routing table.


Could you elaborate on the Mach kernel having multiple routing tables?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: