Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- TAIL
- python
- 패스워드초기화
- 리눅스 기본명령어
- uname
- 우분투패스워드초기화
- passwd
- Ubuntu 22.04
- 엔비디아 도커
- NGC
- sudoer
- netplan
- 도커 설치
- docker
- CUDA
- V100
- 우분투 22.04 패스워드 초기화
- TensorFlow
- ifconfig
- sysstat
- 도커
- 모니터링
- A100
- dmesg
- ethtool
- 우분투
- nvidia-docker
- grub
- nvidia
- Cat
Archives
- Today
- Total
또이리의 Server Engineer
Linux time / date 설정 명령어 - 날짜 / 시간 본문
Linux time / date 설정 명령어 - 날짜 / 시간
Linux time / date 설정
안녕하세요. 오늘은 리눅스에서 시간과 날짜를 설정하는 명령어에 대해서 알아보겠습니다. test 환경은 ubuntu 18.04.4 server version입니다.
timedatectl
root@ubuntu:~# timedatectl
Local time: Mon 2021-02-15 20:50:38 EST
Universal time: Tue 2021-02-16 01:50:38 UTC
RTC time: Tue 2021-02-16 01:50:38
Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
root@ubuntu:~#
timedatectl 이란 명령어를 입력해 보시면 위와 같은 정보를 얻을 수 있습니다.
date라는 명령어를 사용하면 아래와 같이 간단한 시간 날짜 정보를 확인할 수 있습니다.
root@ubuntu:~# date
Mon Feb 15 20:51:11 EST 2021
현재 시스템은 시간과 날짜, 지역이 America/New_York 로 설정이 되어있습니다.
명령어를 사용하여 Asia/Seoul로 변경하겠습니다.
timedatectl 의 명령어의 옵션에 대해서 알아보겠습니다.
root@ubuntu:~# timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode
Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Enable or disable network time synchronization
아래쪽 커맨드를 보시면 set-timezone이라는 명령어가 있습니다. 눈치채셨겠지만, 지역을 설정해 주는 명령어입니다. 해당 지역을 설정해 주시면, 설정한 지역의 타임라인으로 변경되어 날짜와 시간이 변경됩니다.
명령어의 순서는 timedatectl set-timezone 대륙/도시 순으로 입력하시면 됩니다.
보통 timedatectl set-timezone 까지 입력하시고 우리의 만능키 인 tab을 툭툭 치시면 아래와 같이 입력가능한 대륙/도시를 확인할 수 있습니다.
root@ubuntu:~# timedatectl set-timezone
Display all 426 possibilities? (y or n)
Africa/Abidjan America/Atikokan America/Menominee Asia/Amman Asia/Tomsk Europe/Samara
Africa/Accra America/Bahia America/Merida Asia/Anadyr Asia/Ulaanbaatar Europe/San_Marino
Africa/Addis_Ababa America/Bahia_Banderas America/Metlakatla Asia/Aqtau Asia/Urumqi Europe/Sarajevo
Africa/Algiers America/Barbados America/Mexico_City Asia/Aqtobe Asia/Ust-Nera Europe/Saratov
Africa/Asmara America/Belem America/Miquelon Asia/Ashgabat Asia/Vientiane Europe/Simferopol
Africa/Bamako America/Belize America/Moncton Asia/Atyrau Asia/Vladivostok Europe/Skopje
Africa/Bangui America/Blanc-Sablon America/Monterrey Asia/Baghdad Asia/Yakutsk Europe/Sofia
Africa/Banjul America/Boa_Vista America/Montevideo Asia/Bahrain Asia/Yangon Europe/Stockholm
Africa/Bissau America/Bogota America/Montserrat Asia/Baku Asia/Yekaterinburg Europe/Tallinn
Africa/Blantyre America/Boise America/Nassau Asia/Bangkok Asia/Yerevan Europe/Tirane
Africa/Brazzaville America/Cambridge_Bay America/New_York Asia/Barnaul Atlantic/Azores Europe/Ulyanovsk
Africa/Bujumbura America/Campo_Grande America/Nipigon Asia/Beirut Atlantic/Bermuda Europe/Uzhgorod
Africa/Cairo America/Cancun America/Nome Asia/Bishkek Atlantic/Canary Europe/Vaduz
Africa/Casablanca America/Caracas America/Noronha Asia/Brunei Atlantic/Cape_Verde Europe/Vatican
Africa/Ceuta America/Cayenne America/North_Dakota/Beulah Asia/Chita Atlantic/Faroe Europe/Vienna
Africa/Conakry America/Cayman America/North_Dakota/Center Asia/Choibalsan Atlantic/Madeira Europe/Vilnius
Africa/Dakar America/Chicago America/North_Dakota/New_Salem Asia/Colombo Atlantic/Reykjavik Europe/Volgograd
Africa/Dar_es_Salaam America/Chihuahua America/Ojinaga Asia/Damascus Atlantic/South_Georgia Europe/Warsaw
Africa/Djibouti America/Costa_Rica America/Panama Asia/Dhaka Atlantic/Stanley Europe/Zagreb
Africa/Douala America/Creston America/Pangnirtung Asia/Dili Atlantic/St_Helena Europe/Zaporozhye
Africa/El_Aaiun America/Cuiaba America/Paramaribo Asia/Dubai Australia/Adelaide Europe/Zurich
Africa/Freetown America/Curacao America/Phoenix Asia/Dushanbe Australia/Brisbane Indian/Antananarivo
Africa/Gaborone America/Danmarkshavn America/Port-au-Prince Asia/Famagusta Australia/Broken_Hill Indian/Chagos
Africa/Harare America/Dawson America/Port_of_Spain Asia/Gaza Australia/Currie Indian/Christmas
Africa/Johannesburg America/Dawson_Creek America/Porto_Velho Asia/Hebron Australia/Darwin Indian/Cocos
Africa/Juba America/Denver America/Puerto_Rico Asia/Ho_Chi_Minh Australia/Eucla Indian/Comoro
Africa/Kampala America/Detroit America/Punta_Arenas Asia/Hong_Kong Australia/Hobart Indian/Kerguelen
Africa/Khartoum America/Dominica America/Rainy_River Asia/Hovd Australia/Lindeman Indian/Mahe
Africa/Kigali America/Edmonton America/Rankin_Inlet Asia/Irkutsk Australia/Lord_Howe Indian/Maldives
Africa/Kinshasa America/Eirunepe America/Recife Asia/Jakarta Australia/Melbourne Indian/Mauritius
Africa/Lagos America/El_Salvador America/Regina Asia/Jayapura Australia/Perth Indian/Mayotte
Africa/Libreville America/Fortaleza America/Resolute Asia/Jerusalem Australia/Sydney Indian/Reunion
Africa/Lome America/Fort_Nelson America/Rio_Branco Asia/Kabul Europe/Amsterdam Pacific/Apia
Africa/Luanda America/Glace_Bay America/Santarem Asia/Kamchatka Europe/Andorra Pacific/Auckland
Africa/Lubumbashi America/Godthab America/Santiago Asia/Karachi Europe/Astrakhan Pacific/Bougainville
Africa/Lusaka America/Goose_Bay America/Santo_Domingo Asia/Kathmandu Europe/Athens Pacific/Chatham
Africa/Malabo America/Grand_Turk America/Sao_Paulo Asia/Khandyga Europe/Belgrade Pacific/Chuuk
Africa/Maputo America/Grenada America/Scoresbysund Asia/Kolkata Europe/Berlin Pacific/Easter
Africa/Maseru America/Guadeloupe America/Sitka Asia/Krasnoyarsk Europe/Bratislava Pacific/Efate
Africa/Mbabane America/Guatemala America/St_Barthelemy Asia/Kuala_Lumpur Europe/Brussels Pacific/Enderbury
Africa/Mogadishu America/Guayaquil America/St_Johns Asia/Kuching Europe/Bucharest Pacific/Fakaofo
Africa/Monrovia America/Guyana America/St_Kitts Asia/Kuwait Europe/Budapest Pacific/Fiji
Africa/Nairobi America/Halifax America/St_Lucia Asia/Macau Europe/Busingen Pacific/Funafuti
Africa/Ndjamena America/Havana America/St_Thomas Asia/Magadan Europe/Chisinau Pacific/Galapagos
Africa/Niamey America/Hermosillo America/St_Vincent Asia/Makassar Europe/Copenhagen Pacific/Gambier
Africa/Nouakchott America/Indiana/Indianapolis America/Swift_Current Asia/Manila Europe/Dublin Pacific/Guadalcanal
Africa/Ouagadougou America/Indiana/Knox America/Tegucigalpa Asia/Muscat Europe/Gibraltar Pacific/Guam
Africa/Porto-Novo America/Indiana/Marengo America/Thule Asia/Nicosia Europe/Guernsey Pacific/Honolulu
Africa/Sao_Tome America/Indiana/Petersburg America/Thunder_Bay Asia/Novokuznetsk Europe/Helsinki Pacific/Kiritimati
Africa/Tripoli America/Indiana/Tell_City America/Tijuana Asia/Novosibirsk Europe/Isle_of_Man Pacific/Kosrae
Africa/Tunis America/Indiana/Vevay America/Toronto Asia/Omsk Europe/Istanbul Pacific/Kwajalein
Africa/Windhoek America/Indiana/Vincennes America/Tortola Asia/Oral Europe/Jersey Pacific/Majuro
America/Adak America/Indiana/Winamac America/Vancouver Asia/Phnom_Penh Europe/Kaliningrad Pacific/Marquesas
America/Anchorage America/Inuvik America/Whitehorse Asia/Pontianak Europe/Kiev Pacific/Midway
America/Anguilla America/Iqaluit America/Winnipeg Asia/Pyongyang Europe/Kirov Pacific/Nauru
America/Antigua America/Jamaica America/Yakutat Asia/Qatar Europe/Lisbon Pacific/Niue
America/Araguaina America/Juneau America/Yellowknife Asia/Qostanay Europe/Ljubljana Pacific/Norfolk
America/Argentina/Buenos_Aires America/Kentucky/Louisville Antarctica/Casey Asia/Qyzylorda Europe/London Pacific/Noumea
America/Argentina/Catamarca America/Kentucky/Monticello Antarctica/Davis Asia/Riyadh Europe/Luxembourg Pacific/Pago_Pago
America/Argentina/Cordoba America/Kralendijk Antarctica/DumontDUrville Asia/Sakhalin Europe/Madrid Pacific/Palau
America/Argentina/Jujuy America/La_Paz Antarctica/Macquarie Asia/Samarkand Europe/Malta Pacific/Pitcairn
America/Argentina/La_Rioja America/Lima Antarctica/Mawson Asia/Seoul Europe/Mariehamn Pacific/Pohnpei
America/Argentina/Mendoza America/Los_Angeles Antarctica/McMurdo Asia/Shanghai Europe/Minsk Pacific/Port_Moresby
America/Argentina/Rio_Gallegos America/Lower_Princes Antarctica/Palmer Asia/Singapore Europe/Monaco Pacific/Rarotonga
America/Argentina/Salta America/Maceio Antarctica/Rothera Asia/Srednekolymsk Europe/Moscow Pacific/Saipan
America/Argentina/San_Juan America/Managua Antarctica/Syowa Asia/Taipei Europe/Oslo Pacific/Tahiti
America/Argentina/San_Luis America/Manaus Antarctica/Troll Asia/Tashkent Europe/Paris Pacific/Tarawa
America/Argentina/Tucuman America/Marigot Antarctica/Vostok Asia/Tbilisi Europe/Podgorica Pacific/Tongatapu
America/Argentina/Ushuaia America/Martinique Arctic/Longyearbyen Asia/Tehran Europe/Prague Pacific/Wake
America/Aruba America/Matamoros Asia/Aden Asia/Thimphu Europe/Riga Pacific/Wallis
America/Asuncion America/Mazatlan Asia/Almaty Asia/Tokyo Europe/Rome UTC
거의 대부분의 대륙과 도시를 확인 할수 있습니다.
그렇다면 기존의 명령어 뒤에 입력해 주시면 됩니다.
timedatectl set-timezone Asia/Seoul
root@ubuntu:~# timedatectl set-timezone Asia/Seoul
root@ubuntu:~# date
Tue Feb 16 11:02:46 KST 2021
root@ubuntu:~# timedatectl
Local time: Tue 2021-02-16 11:02:51 KST
Universal time: Tue 2021-02-16 02:02:51 UTC
RTC time: Tue 2021-02-16 02:02:51
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
root@ubuntu:~#
위와 같이 간단한 방법으로 변경된 시간과 날짜를 확인할 수 있습니다. time zone도 변경되었습니다.
감사합니다.
'Linux Engineer' 카테고리의 다른 글
ubuntu 22.04 server 우분투 패스워드 초기화 passwd / grub / reset (0) | 2023.04.19 |
---|---|
리눅스 파일보기 명령어 - cat, more, less, head, tail (2) | 2021.03.28 |
TensorFlow install (NVIDA NGC) 텐서플로우 설치 (0) | 2021.01.21 |
FIO test - NVMe / SSD / HDD 속도 테스트 (0) | 2020.12.27 |
리눅스 ls 명령어 - 기본 명령어 (0) | 2020.12.09 |
Comments