Solve the problem that the ifconfig command in RedHat cannot be used

Source: Internet
Author: User

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.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.