In Linux, shell is a commonly used tool. In Red Hat Linux, we usually use B shell or bash. In Shell, we always want to set some environment variables or other initialization operations when opening this shell. But how can we do this? Although we can use the set or Export Statement to set the environment variable, it is very painful to re-open another shell and re-export it. On Windows, we can set the PATH environment variable in the attributes of my computer. in Linux, it seems that this option is not found. What should we do.
In fact, it is in the directory of each user. For example, if your user name is test, there is a. bashrc hidden file under the/home/test directory. You can open this file through VI. Then write some statements in the file. These statements are automatically run during shell initialization, and your environment variables are automatically set. For example, in the current. bashrc file, add the following statement:
Sbin =/ Sbin
Export Path = $ Path : $ Sbin
Then exit VI and enter source. after the bashrc command is imported, you will find that the ifconfig command under/sbin can be run without/sbin. If you do not believe it, You can directly enter the command ifconfig to see it. Re-open a shell and find that the ifconfig command can be run directly.