Linux host name modification command

angryTom
Release: 2020-02-06 09:39:22
Original
12494 people have browsed it

Linux host name modification command

Linux host name modification command

1. If you only need to temporarily change the host name, you can use the hostname command.

sudo hostname <new-hostname>
# 例如:
sudo hostname myDebian
Copy after login

This command will not change the static hostname (static hostname) in the /etc/hostname file, 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 the hostnamectl command, or use vim to manually modify the /etc/hostname file

command syntax For:

sudo hostnamectl set-hostname <newhostname>
# sudo vim /etc/hostname
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!