Modify the computer name in Linux and the computer name in Linux

Source: Internet
Author: User

Modify the computer name in Linux and the computer name in Linux

SuSe operating system:

  1. Modify the/etc/HOSTNAME file with the computer name.

Run vi/etc/HOSTNAME to delete all content one by one using the x key on the keyboard, and then enter the computer name (without adding a domain name) in the Editable State using the I key on the keyboard) after the modification is complete, enter the command wq to save and exit.

  2. Modify the/etc/hosts file and add a line to the file content

Xxx. xxx computer name (xxx. xxx is an IP address)

Run vi/etc/hosts to move the cursor to the row below 127.0.0.1 localhost. Run I to insert the content into the file, for example, 192.168.1.101 linux. After linux is changed to the computer name, enter the command: wq save and exit

  3. Restart linux (Note: if it is not convenient to restart the computer, you can run the following command, but it may not be guaranteed to be successful. If not, restart linux)

Method 1: Enter the command:/etc/rc. d/boot. localnet start Method 2: Enter the command: hostname, computer name, and press enter (for example, hostname linux). Then press Enter: su to press Enter.

  

RedHat operating system:

  1. Modify the/etc/sysconfig/network file with the computer name

Run vi/etc/sysconfig/network to delete all content one by one with the x key on the keyboard. Then, use the I key on the keyboard to enter the Editable state and enter the computer name (without adding a domain name) after the modification is complete, enter the command wq to save and exit.

  2. Modify the/etc/hosts file and add a line to the file content

Xxx. xxx computer name (xxx. xxx is an IP address)

Run vi/etc/hosts to move the cursor to the row below 127.0.0.1 localhost. Run I to insert the content into the file, for example, 192.168.1.101 linux. After linux is changed to the computer name, enter the command: wq save and exit

  3. Restart linux (Note: if it is not convenient to restart the computer, you can run the following command, but it may not be guaranteed to be successful. If not, restart linux)

Enter the command: Enter the Host Name and press enter (for example, hostname linux). Then, enter: su press Enter.

How to change the linux computer name

Open the terminal and run vi/etc/hostname as root
 
How do you view and change the computer name in hero linux?

View computer name: Enter hostname on the terminal
Changed hostname + computer name (expired after restart)
To be permanently modified, modify the configuration file/etc/sysconfig/network.
Modify hostname = name you want to change

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.