1. date
시스템 날짜와 시간을 출력하거나 설정한다
사용법
| date [옵션] [포맷] [날짜] |
포맷
+%d : 날짜를 출력
| [root@Linux ~]# date +%d 24 |
+%x : 년도 월 일 을 출력
| [root@Linux ~]# date +%x 04/24/2023 |
+%R : 시간을 출력
| [root@Linux ~]# date +%R 17:20 |
옵션
기본 : 기본 날짜를 출력
| [root@Linux ~]# date Mon Apr 24 05:19:44 PM KST 2023 |
d(date) : 지정한 날짜를 출력
| [root@Linux ~]# date -d 2023/03/21 Tue Mar 21 12:00:00 AM KST 2023 |
I(iso-8601) : ISO-8601형식으로 출력
| [root@Linux ~]# date -I 2023-04-28 |
2. timedatectl
시스템의 날짜 및 시간을 확인하거나 설정하는 명령이다.
사용법
timedatectl [command]
| 명령 | 설명 |
| status | 시스템의 시간 및 RT(Real Time Clock)의 시간 정보를 출력 |
| set-time | 시스템의 시간을 설정하는 명령 |
| list-timezones | 사용 가능한 타임존 목록을 출력 |
| set-timezone | 타임존을 섷정하는 명령 |
| set-ntp 값 | NTP 사용 여부를 지정하는 명령 |
예시)
설정확인
리스트 보기
| [root@Linux ~]# timedatectl list-timezones Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul Africa/Bissau . . . |
타임 설정(지역)
| [root@Linux ~]# timedatectl set-timezone Asia/Seoul [root@Linux ~]# timedatectl #변경확인 Local time: Thu 2023-05-04 17:03:13 KST Universal time: Thu 2023-05-04 08:03:13 UTC RTC time: Thu 2023-05-04 08:03:13 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no |
타임 직접 변경시
| [root@Linux ~]# timedatectl set-time 15:30 Failed to set time: Automatic time synchronization is enabled #ntp 자동설정으로 인한 변경불가 |
ntp 자동설정 해제
| [root@Linux ~]# timedatectl set-ntp false [root@Linux ~]# timedatectl Local time: Thu 2023-05-04 17:13:32 KST Universal time: Thu 2023-05-04 08:13:32 UTC RTC time: Thu 2023-05-04 08:13:33 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: inactive RTC in local TZ: no |
3. tzselect
원하는 도시가 있는 곳을 골라 정확인 단어를 알아낸 후 시스템의 날짜를 설정할 수 있다.
| [root@linux ~]# tzselect Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 2) Americas 3) Antarctica 4) Asia #자신이 선택할 도시가 속한 곳을 고른다 5) Atlantic Ocean 6) Australia 7) Europe 8) Indian Ocean 9) Pacific Ocean 10) coord - I want to use geographical coordinates. 11) TZ - I want to specify the timezone using the Posix TZ format. # 확인한 설정으로 시간을 설정한다. # 서울로 변경 [root@linux ~]# timedatectl set-timezone Asia/Seoul [root@linux ~]# timedatectl Local time: Thu 2023-05-04 18:18:06 KST Universal time: Thu 2023-05-04 09:18:06 UTC RTC time: Thu 2023-05-04 09:18:05 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no |
'리눅스-기초명령어 > 시스템 설정' 카테고리의 다른 글
| hostnamectl (0) | 2023.09.01 |
|---|---|
| NTP(Network Time Protocol) (0) | 2023.09.01 |