How to modify linux host name

Source: Internet
Author: User

Run the # uname-ncsdba # hostnamecsdba1 command to modify the linux host name and view the host name. Run the hostname command. Command Format: hostname newhostname this command is used to temporarily modify the linux host name. Its survival time is the current linux running time, that is, the running time before the restart. It usually takes effect after modification, but it cannot be modified permanently. 2. It can be modified through the configuration file/etc/sysconfig/network. ------------------------------------------------------ # Cat/etc/sysconfig/networkNETWORKING = yesHOSTNAME = localhost. localdomain ------------------------------------------------------ by modifying the content of this file, it can permanently modify the linux host name, but it does not take effect immediately, that is, it may not take effect at the current running time, that is, it takes effect only after the next restart, at least not in the current session, and takes effect only after the user exits. By modifying this configuration file and using the hostname command, you can immediately and permanently modify the linux host name. 3. file/etc/hosts function. The function of this file is to provide a comparison between the ip address and the host name. linux uses this file to know that an ip address corresponds to a host name, for example, if the ip address of google is 10.23.56.238, you can add a line at the end of the file: 10.23.56.238 google.com, which corresponds to a row. The format of each line is: what is the role of this file to store the Host Name and ip address of the Local Machine? Some software uses this file to implement the correspondence between host names and ip addresses, such as oracle. This file provides settings for your local machine, which is similar to right-clicking on my computer in windows, setting properties, and setting the host name in the computer name.

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.