본문 바로가기

기타/Linux

[우분투] Ubuntu 20.04 호스트 이름 확인하기

Ubuntu 20.04 호스트 이름 관리하는 방법

우분투 Hostname

Hostname 확인하기

우분투 터미널에서 hostname 명령어로 이름을 확인할 수 있다.

microserver:~$ hostname
microserver

또는 /etc/hostname 을 읽어서 이름을 확인할 수 있다.

microserver:~$ cat /etc/hostname 
microserver

Hostname 바꾸기

우분투 터미널에서 hostnamectl 명령어로 이름을 바꿀 수 있다.

microserver:~$ cat /etc/hostname 
microserver

microserver:~$ hostnamectl set-hostname webserver
==== AUTHENTICATING FOR org.freedesktop.hostname1.set-static-hostname ===
Authentication is required to set the statically configured local host name, as well as the pretty host name.
Authenticating as: makepluscode,,, (makepluscode)
Password: 
==== AUTHENTICATION COMPLETE ===

microserver:~$ cat /etc/hostname 
webserver

또는 /etc/hostname 의 이름을 수정하면 서버 이름이 변경된다.

참고자료

https://www.cyberciti.biz/faq/ubuntu-change-hostname-command/

 

Ubuntu Linux Change Hostname (computer name)

Ubuntu Linux Change Hostname: Explains how to change the Ubuntu computer/server/laptop name (hostname) using the CLI without reboot.

www.cyberciti.biz