Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if Linux does not have ifconfig

What to do if Linux does not have ifconfig

青灯夜游
青灯夜游Original
2022-03-24 19:13:109220browse

Use the yum command to install the ifconfig tool. The ifconfig tool is included in the "net-tools" tool package. You only need to open a terminal and execute the "yum install net-tools package name" command to install the "net-tools" tool package, and you can use the ifconfig command.

What to do if Linux does not have ifconfig

#The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.

The ifconfig command is a program that sets or displays the network interface. It can display the network card information of our machine. However, sometimes when minimally installing Linux distributions such as CentOS, ifconfig and other commands will not be installed by default. At this time, you Enter the terminal and run the ifconfig command and an error will occur.

The first thing I think about is whether there is no path to the ifconfig command in the environment variable, because ifconfig is under the /sbin path, as the root user It can be run only after logging in. Look at the environment variables of the root user.

The environment variable contains the path /sbin. That is to say, if the ifconfig command exists and is located in the /sbin directory If it is, it can definitely be run, then check if there is an ifconfig command in the /sbin directory

The result shows that there is no ifconfig command in the /sbin directory, so: ifconfig is not installed in CentOS

Solution: Use yum to install ifconfig

Through the yum search command, we found that the ifconfig command is in the net-tools tool package. Next, we only need to install this package.

Check if the installation is successful

Run successfully!

At this time, are you as confused as I was at the beginning? Why is the ipconfig command in Windows not required to be installed in Linux? It turns out that the ifconfig command comes from net-tools. This package includes ifconfig and netstat. , whois and other commands, so you could not run these commands before

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What to do if Linux does not have ifconfig. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn