In RedHat, open the terminal and run the "ifconfig" command. If the prompt is "command not found", we can solve the problem as follows:
1. Enter the absolute path of the ifconfig command. ifconfig is under the/sbin directory. Therefore, run the following command on the terminal:
/Sbin/ifconfig
2. You can also modify the profile file and add the/sbin directory to the path. In this way, you can run this command without entering an absolute path, regardless of the directory. The method is as follows:
A. Open the/etc/profile file with the root permission:
VI/etc/profile
Add the following code to the last line of the file, save the file, and exit.
Export Path = $ path:/sbin
Run the following commands on the terminal:
Source/etc/profile
Then enter "ifconfig" to run the command directly.
----------------------------------
After installing RedHat Linux 5, I run some commands on the terminal, for example, ifcinfig, to check the IP address of the local machine, and found that the command cannot be used, prompting "command not found ", what should I do? If the environment variable is not loaded, modify the environment variable as follows:
After the system is initially installed, the path of some commands is not in the path environment variable for higher security. You can use the echo $ PATH command to query and learn, to add a path to a path environment variable, follow these steps:
(For example, add/sbin to the path environment variable)
(1) If you only want to add temporary modifications during the current Boot Process, the next boot will be invalid, you can:
Enter export Path = $ path:/sbin
(2) If only the current user is permanently added:
In ~ /. There is a line similar to this path near the end of bash_profile = $ path: $ home/bin and then add:/sbin, it becomes Path = $ path: $ home/bin:/sbin
Run source ~ The/. bash_profile command takes effect immediately.
(3) If all users in the system are permanently added:
Add export Path = $ path:/sbin at the end of the/etc/profile file
After the file is modified and maintained, run the source etc/profile command to make the modification take effect immediately.