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