Open Linux ifconfig and other system commands for the current user
Source: Internet
Author: User
The newly installed Linux cannot execute the ifconfig command. The Command bash: ifconfigcommandnotfound does not actually configure the ifconfig directory in the environment variable. this program is actually in the/sbin directory. In fact, sbin contains some system management commands. Therefore, for general users, the ifconfig command cannot be executed in the newly installed Linux:
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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.