Home>Article>Operation and Maintenance> Linux host name modification command
Linux host name modification command
1. If you only need to temporarily change the host name, you can use thehostnamecommand.
sudo hostname# 例如: sudo hostname myDebian
This command will not change the static hostname (static hostname) in the/etc/hostnamefile, it only changes the temporary hostname (transient hostname). So after restarting the computer it will go back to the old hostname.
2. If you want to permanently change the host name, you can use thehostnamectlcommand, or use vim to manually modify the/etc/hostnamefile
command syntax For:
sudo hostnamectl set-hostname# sudo vim /etc/hostname
This command will delete the host name in the /etc/hostname file and replace it with the new host name.
(Online video tutorial sharing:linux video tutorial)
The above is the detailed content of Linux host name modification command. For more information, please follow other related articles on the PHP Chinese website!