Problem description:
The centos7 system has been installed in the Virtual Machine. When you view the IP address and use the ifconfig command, the system prompts that the command cannot be found. You can use the ip addr command to query the IP addresses of the current system (1, 2 ):
Figure 1
Figure 2
Solution steps:
1. First, you will think about whether the ifconfig command path is not in the environment variable, because ifconfig is in the/sbin path and can be run only when the root user logs on, however, we logged on as the root user to check the environment variables of the root user;
The above environment variable contains the path/sbin. If the ifconfig command exists and is located in the/sbin directory, we can certainly run it, so let's see if there is any ifconfig command in the/sbin directory.
The result shows that the ifconfig command is not in the/sbin directory, so the conclusion is: ifconfig is not installed in centos.
2. Install the ifconfig command package in Yum (3)
Figure 3
Through the yum SEARCH Command we found that the ifconfig command is in the net-tools.x86_64 package, then install this package on the line (4, 5)
Figure 4
Figure 5
Summary:
The ifconfig command comes from net-tools, which contains ifconfig, netstat, Whois, and other commands. Therefore, these commands cannot be run before.
The ifconfig command for viewing IP addresses in centos 7 cannot identify how to handle the issue.