Home>Article>Operation and Maintenance> Linux host name modification command

Linux host name modification command

angryTom
angryTom Original
2020-02-06 09:39:22 12465browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to check IP in Linux Next article:How to check IP in Linux