리눅스 7.x 이상 부터 hostname 변경시 hostnamectl 명령어로 hostname를 쉽게 변경 할 수 있습니다.
[root@localhost ~]# hostname
localhost.localdomain --> 기본적으로 현재 사용 중인 이름
[root@localhost ~]#
[root@localhost]# hostnamectl set-hostname SLASM19C
[root@localhost]# hostname
slasm19c --> 소문자로 변경 되었네요.
[root@localhost]#
[root@localhost]# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...
Query or change system hostname.
-h --help Show this help
--version Show package version
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--transient Only set transient hostname
--static Only set static hostname
--pretty Only set pretty hostname
Commands:
status Show current hostname settings
set-hostname NAME Set system hostname
set-icon-name NAME Set icon name for host
set-chassis NAME Set chassis type for host
set-deployment NAME Set deployment environment for host
set-location NAME Set location for host
[root@localhost]#
[root@localhost ~]# hostnamectl set-hostname SLASM19C --static
[root@localhost ~]# hostname
SLASM19C --> 대문자로 변경
[root@localhost ~]#
[root@localhost ~]# reboot
[root@SLASM19C ~]# hostname
SLASM19C
[root@SLASM19C ~]#
[root@SLASM19C etc]# more /etc/hostname
SLASM19C
[root@SLASM19C etc]#
[root@SLASM19C etc]# hostnamectl set-hostname SLasm9c --static
[root@SLASM19C etc]# hostname
SLasm9c --> 대소문자 변경
[root@SLASM19C etc]#
[root@SLASM19C etc]# hostnamectl
Static hostname: SLasm9c
Icon name: computer-vm
Chassis: vm
Machine ID: 3f62be271cd1354d98aedb0211e7bffa
Boot ID: fa751d2126f441a29c000abcef1ba4c3
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.7 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.7:GA:server
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
[root@SLASM19C etc]
[root@server-150 ~]# hostnamectl
Static hostname: server-150
Icon name: computer-vm
Chassis: vm
Machine ID: 36cc986e11e540708dbf81d00c454c56
Boot ID: 81d0fc11950a4842b3693b9122cda935
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.2:GA:server
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@server-150 ~]#
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
26 | read 명령어 사용법 | 명품관 | 2024.01.22 | 56 |
25 | df 명령어 대신 사용할 수 있는 python용 pydf | 명품관 | 2023.03.14 | 184 |
24 | Step by Step Installing CentOS Linux 8 with Screenshots | 명품관 | 2019.09.26 | 310 |
23 | 세마포어(semaphore) | 명품관 | 2021.12.21 | 488 |
22 | 절대 경로가 포함된 스크립트 생성 하기 [1] | Talros | 2016.10.10 | 543 |
21 | "리눅스에 대한 마이크로소프트의 사랑", WSL 2의 이해와 시작하기 | 명품관 | 2019.09.23 | 544 |
20 | Installing RedHat Enterprise Linux 8.0 with screenshots | 명품관 | 2019.09.26 | 546 |
19 | bpytop 모니터링 툴 | 명품관 | 2021.01.18 | 629 |
18 | vi 에디터 환경 설정 | 명품관 | 2016.02.02 | 643 |
17 | Swap File 생성하기 | 명품관 | 2019.04.15 | 663 |
16 | Alias 사용 | 명품관 | 2021.03.03 | 673 |
15 | find 사용하기 | 명품관 | 2016.03.04 | 738 |
14 | top logging script | Talros | 2020.01.17 | 830 |
13 | Linux에서 LVM 사용 | 명품관 | 2020.11.10 | 852 |
12 | 리눅스 Free 메모리의 이해 | 명품관 | 2018.08.08 | 989 |
» | [7.x] hostname 변경하는 hostnamectl 사용법 [1] | 우뽕 | 2020.02.05 | 1000 |
10 | Memory Usage 확인용 스크립트 [2] | 명품관 | 2019.04.15 | 1421 |
9 | 59 Linux Networking commands and scripts | 명품관 | 2019.11.18 | 1592 |
8 | 실시간으로 TCP와 UDP 포트를 감시하는 방법 | 명품관 | 2020.02.05 | 2219 |
7 | iscsi 서버/클라이언트 설정하기(with targetcli) | 명품관 | 2020.11.14 | 2235 |
이런 명령어도 있었군요...
좋아요... ㅎㅎ