152

I've just installed Ubuntu 18.04 and selected "minimal install". I then tried to run ifconfig in the terminal and got the following message

-bash: ifconfig: command not found

How come the net-tools package is not installed by default any more?

Seth
  • 57,282
  • 43
  • 144
  • 200
JiiB
  • 1,623
  • 2
  • 7
  • 6
  • @dessert True. Maybe you can tell me if the `fc-cache` command is a defualt package or not? – JiiB May 03 '18 at 17:14
  • @JiiB On a box without a GUI? No, probably not. And a *minimal* install would be without X. – vidarlo May 03 '18 at 17:16
  • 1
    I edited your question to address solely `ifconfig` because it would be considered too broad and possibly primarily opinion-based as it was. If you're asking about other specific commands/packages as well, please [ask a new question](https://askubuntu.com/questions/ask) for them. – dessert May 03 '18 at 17:46
  • 2
    You might be interested in [how to find a package name by the command name](https://askubuntu.com/q/32238/507051) and [How do I list the default installed packages?](https://askubuntu.com/q/48886/507051). – dessert May 03 '18 at 17:52
  • apt install -y net-tools – bronze man Sep 17 '21 at 09:12

4 Answers4

215

ifconfig is deprecated, and has been so for quite a number of years. The new kid in town is the ip command, which can configure IP's, routes, and everything associated with networks.

You can install ifconfig with sudo apt install net-tools, if you absolutely need to have it. If not, start learning ip.

In short, it is removed because you should not use it. It has mediocre IPv6 support, the ip command is a better replacement. I find sources saying ifconfig was deprecated back in 2012, so I'm not surprised it's finally removed.

You may be able to install it on 18.04, but on future releases it may disappear entirely. I would consider it not being installed by default as a warning shot: learn ip.

Thus ifconfig is probably in a special class. In previous versions of Ubuntu it was included in minimal installs. It is now being phased out, and you explicitly have to install it. This can not be taken to indicate that any other packages are missing.

vidarlo
  • 21,954
  • 8
  • 58
  • 84
  • 19
    To further clarify, the command ip is included in the minimal installation of Ubuntu 18.04, no need to install anything additional. – 64pi0r May 03 '18 at 17:37
  • 4
    You may find `ifconfig` installed, if you install one of the various packages which still haven't been updated to use `ip`, or if you upgraded from an older release of Ubuntu. But you should be aware that `ifconfig` may not be present on modern systems, and should not rely on it. And actually [`ifconfig` was deprecated _in 2009_](https://serverfault.com/q/633087/126632). – Michael Hampton May 04 '18 at 04:03
  • 51
    Use `ip -c a` to highlight the IP addresses with colors. – jingyu9575 May 04 '18 at 14:16
  • 4
    @jingyu9575 you changed my life – I'm here for Winter Hats May 04 '18 at 15:36
  • I find it rather disturbing that `ip a` for me still has some color in it even without a `-c`. Admittedly not of recent vintage, still... – infixed May 04 '18 at 18:01
  • on further examination the color I saw is some side effect in mobaxterm magically trying to help – infixed May 04 '18 at 18:10
  • 10
    Minimalist Docker installs may not have `ip` installed, do `apt install -y iproute2` in those cases. – Terry Brown Oct 28 '19 at 19:51
  • Is the ipv6 reason the only one to justify deprecation of ifconfig? Because henostly, ipv6 is not that much used and I doubt sys admin use it every day as we do with ipv4. – Itération 122442 Dec 04 '19 at 09:52
  • @FlorianCastelain IPv6 adoption is a rather bad excuse; it is happening, it's gaining momentum, and everyone agree that we have to do it. Poor tools will not make adaption faster, so if tools change to aid adaption to IPv6, it's good - not bad... – vidarlo Dec 04 '19 at 11:47
  • more better way to see `ip -c -o -f inet add` – Satish Dec 17 '20 at 05:53
38

as addition to @vidarlo answer, you can put alias ifconfig='ip -c a' to .bash_aliases if you have typing habit.

abu_bua
  • 10,473
  • 10
  • 45
  • 62
Brend
  • 481
  • 4
  • 3
9

This makes the copying of IP addies simpler:

alias ifconfig="ip -c a | sed -e 's/\// \//g'"

(otherwise that subnet slash prevents doubleclick->select of only the IP)

Red Pill
  • 221
  • 2
  • 2
1

I had to do:

sudo apt-get install net-tools
sudo apt autoremove

I guess that the second line be optional.

My runtime system:
   Operating System: Ubuntu 18.04

Cloud Cho
  • 541
  • 6
  • 11