10 ms·
I'm trying hard to fight my old muscle memory to use ip instead of ifconfig on Linux. I have a few issues though: * "ip" is useless as a keyword if you're loo
by simias 8y ago
I'm trying hard to fight my old muscle memory to use ip instead of ifconfig on Linux.
I have a few issues though:
* "ip" is useless as a keyword if you're looking for help online. It's extremely frustrating and probably my main issue actually learning how to use the damn thing.
* ifconfig's output is simply more readable IMO: https://svkt.org/~simias/up/20180525-113825_ip-vs-ifconfig.png https://svkt.org/~simias/up/20180525-113825_ip-vs-ifconfig.p... . It's pretty weird that a brand new tool manages to have worse output than a venerable old unix command. Because of this I often end up configuring the network with ip only to double-check everything is right with a quick ifconfig. That's silly.
I think at this point I would've preferred if they had made an "ifconfig2" instead, mostly identical to the old one but with a few breaking changes to add the missing functionality. An incremental update instead of a full rewrite. There's definitely some NIH going on.
- Faaak 8y agoExactly. Even the `ip` name is misleading as the command does much more than only ip-related things (link layer, network namespaces, tcp, …).
- nailer 8y agoAlways wondered about this - is IP 'internet protocol' or something else, since it's much lower level than IP? I've been using IP route 15 for 15, maybe 20 years now and hinestly have no idea.
- sverige 8y agoYes, it is 'internet protocol' [0] and part of TCP/IP.[1] [0] https://en.wikipedia.org/wiki/Internet_Protocol https://en.wikipedia.org/wiki/Internet_Protocol [1] https://en.wikipedia.org/wiki/Internet_protocol_suite https://en.wikipedia.org/wiki/Internet_protocol_suite
- nailer 8y agoI know what IP is. Your reference doesn't answer the question as to whether 'ip' means IP.
- viraptor 8y ago> "ip" is useless as a keyword Most docs will mention iproute2. You can use that for googling.
- xupybd 8y agoYeah that’s what I loved about this article, I finally know what to google.
- Izkata 8y agoFuture tip: your package manager should be able to find this for you, for example: > $ which ip > /sbin/ip > $ dpkg -S /sbin/ip > iproute2: /sbin/ip
- amyjess 8y agoYou may also want 'whereis' instead of 'which'. I use cope to colorize my output, which makes 'which' useless to me for most common commands, but 'whereis' still works. Edit for examples: $ which ip /usr/share/perl5/vendor_perl/auto/share/dist/Cope/ip $ whereis ip ip: /usr/bin/ip /usr/share/perl5/vendor_perl/auto/share/dist/Cope/ip /usr/share/man/man7/ip.7.gz /usr/share/man/man8/ip.8.gz
- 8_hours_ago 8y ago> whereis Thanks for this! After 14+ years of using Linux almost daily, I had never heard of this command. I learned something new today, so now it's time to go home!
- ssebastianj 8y agoYeah, I recently "discovered" the commands 'whatis' [0] and 'apropos' [1] and my experience learning Linux improved quite a bit. [0] https://linux.die.net/man/1/whatis https://linux.die.net/man/1/whatis [1] https://linux.die.net/man/1/apropos https://linux.die.net/man/1/apropos
- isostatic 8y ago> ifconfig's output is simply more readable IMO Yes, this is key, and why ip is so terrible for the way I currently work. No doubt I'll have to get used to it, like those stupid biosdevname interfaces. 90% of my machines don't have more than 1 IP per physical interface, the rest are aliases ifconfig outputs clear whitespace, so picking out the specific details of - interface name - ip address Is far easier. I do prefer /28 to 255.255.255.240 when specifying subnets, but it does make it far harder to scan what the IP is. I suspect the people writing the utilities are the ones who are able to automate everything, as they do the same job 1000 times, with IP in, IP out, and no concern about physical devices, so rarely use the tool to read data, certainly not as a human. You've then got the "what's the default gateway" problem route -n shows it nice and easy Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.26.32.1 0.0.0.0 UG 0 0 0 eth0 172.26.32.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0 ip route -n returns ip route -n Command "-n" is unknown, try "ip route help". Helpful, ip route help is no help at all It's all good having tools to manage lots of ip namespaces etc, that's great in the subset of cases you need that functionality, but for those of us that manage physical machines with physical inputs/outputs, rather than datacenter scale devices, it's a right pain.
- pas 8y agoto get the gateway: ip route show default > > ifconfig's output is simply more readable IMO I prefer iproute2's terseness.
- simias 8y agoI'm not sure "terse" is the right adjective. It presents basically the same amount of information as ifconfig (minus the packet counters) and actually adds a few more flags. It's all about the formatting really. Simply adding an empty line between each interface would go a long way. Also starting the line with the interface name instead of the index. Adding more punctuation to delimit the fields (, : etc...) would be nice too. I mean what the hell: mtu 1500 qdisc pfifo_fast qlen 1000
- emmelaich 8y agoThe man page is good. `ip` takes a --oneline arg to make it more parseable.
- simias 8y agoI'm not sure having everything crammed into a single line makes it better (at least if a human is supposed to parse it and not a machine): https://svkt.org/~simias/up/20180525-125636_ip-vs-ifconfig-2.png https://svkt.org/~simias/up/20180525-125636_ip-vs-ifconfig-2...
- bayindirh 8y agoI have used ip -oneline to parse configuration of servers, and it's really practical. The only real gripe I have with IP is their long argument/switch format. Unlike everyone else, ip is a minority, which accepts long options with single dash "-". This prevents someone from combining many short parameters under a single dash, also it's confusing to use. Yes, it unofficially supports the old double dash format, but if you are supporting it, there's no point in supporting single dash long options.
- rootbear 8y agoThis is ridiculous. I would love to know their justification for using single dash for long options. When did that become the "old way"?? Very old X11 commands and many Solaris commands use a single dash, but nearly all modern commands use double dash. And I agree that this syntax makes it hard to combine single-character options. They must have had a very compelling reason to use a non-standard option syntax.
- yellowapple 8y agoThe only other place I've seen single-dash long options be the norm is within TCL scripts (where that's conventional whenever a proc takes named arguments/options).
- foo101 8y ago
- erikb 8y ago> "ip" is useless as a keyword if you're looking for help online. I don't know the decisions behind the naming either, but the ip shell command comes as part of the iproute2 [1] package. After I found out about this googling became much easier. [1] https://en.wikipedia.org/wiki/Iproute2 https://en.wikipedia.org/wiki/Iproute2
- da_chicken 8y agoWell, sure, but assume you're new and you don't know that. You can usually search for "man ip" to get close, but that usually just gets you a technical reference for an experienced user (the man page) and not a tutorial, introduction, or training doc for someone learning a new tool. "ip command tutorial" works well, though the results are still rather mixed. I get Cisco and Windows results as well until I search "ip command tutorial linux". The point is that searching for "ifconfig tutorial" is going to give you what you want, while "ip route" is probably going to get you Cisco documentation, honestly. Even something like "parse ip output" is going to give you a mix of results from Linux, Windows, or web services while "parse ifconfig output" is a lot more clear. "ip" is simply a saturated keyword, making it a bad keyword.
- erikb 8y agoNot sure why you think I would disagree. I'd say that is exactly my opinion, so I wanted to share that googlable term with the other frustated people out there.
- da_chicken 8y agoI don't think you'd disagree. I just think, "Well, you could search for iproute2," isn't that helpful because it's not that obvious that that is the package name.
- brazzledazzle 8y agoI love how much shorter and terse the output is with iproute2. I reach for it a lot on my mac and get a bit sad when it’s not there.
- segmondy 8y agoYeah, that's if you even have "ip" Was using one of Redhat's base image the other day and there was no "ip" installed, we tried all the tricks in the book searching through /proc to find the ipv4 for a new interface, and we couldn't, we could easily grab the ipv6. Ended up writing some code to grab it using python. :-/
- Willwhatley 8y agoNIH doesn't seem to make sense as "next of hop" or "not in here", and search for this initialism is obfuscated by the National Institute of Health. Mind expanding NIH?
- phab 8y agoNot Invented Here (https://en.wikipedia.org/wiki/Not_invented_here https://en.wikipedia.org/wiki/Not_invented_here)
- deleted 8y ago[deleted]
- h1d 8y agoI think google is smart enough that you search with "ip command" (maybe plus "linux", it'll get relevant results. It's better that the command you type often is short, (you can certainly alias ifconfig as "ifg" or anything too).
- foo101 8y agoYes, DDG gets relevant results too: https://ddg.gg/?q="ip+command" https://ddg.gg/?q="ip+command"
- simias 8y agoMaybe you're better at googling than I am but I've had serious issues with that. The problem is that there are way too many false positives for any query containing "ip" regarding networking. And even looking at the excerpts on the search results page it's not always obvious if "ip" refers to the command or something else. Take for instance a very simple query: "ip show default route": https://duckduckgo.com/?q=ip+command+show+default+route&t=ffab&ia=web https://duckduckgo.com/?q=ip+command+show+default+route&t=ff... There are a few obviously relevant matches in the first page but also a bunch of completely irrelevant results. Adding "command" doesn't improve that much. And that's for a very simple query that's probably been asked hundreds of times before. Meanwhile if I search "ls sort date" I get mostly relevant results immediately because even though it's also a 2 letter identifier it's not quite as ambiguous: https://duckduckgo.com/?q=ls+sort+date&t=ffab&ia=qa https://duckduckgo.com/?q=ls+sort+date&t=ffab&ia=qa
- djsumdog 8y agoI've always thought the same thing. ip addr's output sucks compared to ifconfig. Looking at it more closely now, ip addr's output doesn't seem that difficult to fix. Remove that random number before the adapter name (what the hell is that anyway? The order in which the adapter appeared? If so, why are not in that order?) I think that alone would make it so much more readable! Maybe white space between each entry with a flag? All of the help sections are awful too. I feel like I'm looking at language grammar definition instead of useful usage information.
- lathiat 8y agoIt’s the interface index which is mostly an incrmsenfing number. That can become important for sub interfaces and others things that may reference it. Though they could reference by name instead.
- digi_owl 8y agoPoking at ip and its sub-commands reminds me of poking at the serial interface of a Cisco router, and not in any pleasant way...
- bjourne 8y agoBookmark this PDF: http://homepage.smc.edu/morgan_david/cs70/ip-cref.pdf http://homepage.smc.edu/morgan_david/cs70/ip-cref.pdf
- dabockster 8y agoIt could also be preserved as a legacy flag. ifconfig -L (I don't know if this is already taken. I haven't read the man pages in forever.)
- tzakrajs 8y agoIf you like India Pale Ale, then the handy "ip a" command might come second nature to you. Sounds weird, but this mnemonic was what I needed to get on board.
- damm 8y agoIf only ifconfig was standardized on the output... it's output has changed over time Let alone the non-conformity of other OS's like Solaris, HP-UX which really might not matter now. I'm sure FreeBSD matters to someone... just not me