Solution to ifconfig :command not found command not found in Linux

When using Linux, after entering the ifconfig command, the reason why the command cannot be found and the solution are as follows:

1. The ifconfig tool is not installed (the preferred method):

>>You can use the following command to check

which ifconfig

 If the return result is empty, or if no ifconfig in (/xx path) is prompted, it means that the tool is not installed.

 >>Use the following command to upgrade and install

sudo apt-get install net-tools

 Tip: If apt-get cannot find the command, use yum instead (because some operating systems come with the yum tool.

yum -y install net-tools

2. PATH environment variable configuration problem

If the found ifconfig path is included in PATH, it means there is no problem.

>> If you have any problems, you can modify the configuration file /etc/bashrc or /etc/profile (administrator rights are required, and the modification will be permanent for all users). The modification command is as follows:

vi /etc/bashrc
或者
vi /etc/profile

>> Enter i after pressing Enter, add export PATH=$PATH:/sbin at the end, save and exit, and then execute the source /etc/bashrc or source /etc/profile command to take effect and complete the configuration.

The solutions provided in this article are for reference, depending on the situation. Suggestions for addition and improvement are welcome.

Guess you like

Origin blog.csdn.net/fzy999999/article/details/134007035