The newly installed Linux cannot run the ifconfig command:
Bash: ifconfig command not found
In fact, the ifconfig directory is no longer configured in environment variables. This program is actually in the/sbin directory. In fact, sbin contains some system management commands. Therefore, for general users, this directory will not be configured by default in the user's environment variables, so there is no way to develop the ifconfig command.
In fact, each user has a. bash_profile file stored in the user's home directory, for example,/home/(user_name)/. bash_profile; there are settings for the environment variable PATH. Generally, PATH = $ PATH: $ HOME/bin. The first PATH is the PATH environment variable shared by all users in the system. The current user adds his/her bin directory to the PATH.
In addition, you can use the echo $ PATH command to view the PATH environment variables. However, if you log on to the system as a user, this PATH command is always the environment variable of the current user, even if you use the su command to change the user, the value of the PATH variable remains unchanged. For example, log on as the test user and then su to the root user. However, echo $ PATH always shows the PATH environment variable of the test user, which is actually configured in/home/test/. bash_profile.
Note: env can display all environment variables, but the values of different user restrictions are different.
Therefore, you only need to make the following changes in. bash_profile:
PATH = $ PATH: $ HOME/bin:/sbin
Save the modification. Do not forget to log on again to enable your profile.
Now you can execute ifconfig under the current user.
As mentioned above, this restriction mainly applies to common users. If you log on as a root user at the beginning, it has been set here.