如何修改Linux服务器时间
一、前言
- 个人主页: ζ小菜鸡
- 大家好我是ζ小菜鸡,小伙伴们,让我们一起来学习如何Linux时间。
- 如果文章对你有帮助、欢迎关注、点赞、收藏(一键三连)
二、修改时区
首先在linux下输入命令“ date ”查看当前时间:
date
删除当前时间 命令:
rm-rf /etc/localtime #删除当前默认时区
将当前时区修改为上海时区命令:
ln-s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改默认时区为上海
输入“ date ”查看当前时间,设置完毕
三、修改时间
当前时间:
date
修改时间:
date-s"20140225 20:16:00"#yyyymmdd hh:mm:ss
查看当前系统时间:
date
设置系统时间:
date-s"时间"
查看硬件的时间:
hwclock --show
设置硬件时间:
hwclock --set--date="10/28/2020 10:15:15“
设置系统时间和硬件时间同步:
hwclock --hctosys
保存时间(一定要保存设置,否则下次重新启动时,设置会失效):
clock -w
附件:时区对照表
时区IDUTC偏移Asia/Aden+03:00America/Cuiaba-04:00Etc/GMT+9-09:00Etc/GMT+8-08:00Africa/Nairobi+03:00America/Marigot-04:00Asia/Aqtau+05:00Pacific/Kwajalein+12:00America/El_Salvador-06:00Asia/Pontianak+07:00Africa/Cairo+02:00Pacific/Pago_Pago-11:00Africa/Mbabane+02:00Asia/Kuching+08:00Pacific/Honolulu-10:00Pacific/Rarotonga-10:00America/Guatemala-06:00Australia/Hobart+11:00Europe/LondonZAmerica/Belize-06:00America/Panama-05:00Asia/Chungking+08:00America/Managua-06:00America/Indiana/Petersburg-05:00Asia/Yerevan+04:00Europe/Brussels+01:00GMTZEurope/Warsaw+01:00America/Chicago-06:00Asia/Kashgar+06:00Chile/Continental-03:00Pacific/Yap+10:00CET+01:00Etc/GMT-1+01:00Etc/GMT-0ZEurope/JerseyZAmerica/Tegucigalpa-06:00Etc/GMT-5+05:00Europe/Istanbul+03:00America/Eirunepe-05:00Etc/GMT-4+04:00America/Miquelon-03:00Etc/GMT-3+03:00Europe/Luxembourg+01:00Etc/GMT-2+02:00Etc/GMT-9+09:00America/Argentina/Catamarca-03:00Etc/GMT-8+08:00Etc/GMT-7+07:00Etc/GMT-6+06:00Europe/Zaporozhye+02:00Canada/Yukon-08:00Canada/Atlantic-04:00Atlantic/St_HelenaZAustralia/Tasmania+11:00Libya+02:00Europe/GuernseyZAmerica/Grand_Turk-05:00US/Pacific-New-08:00Asia/Samarkand+05:00America/Argentina/Cordoba-03:00Asia/Phnom_Penh+07:00Africa/Kigali+02:00Asia/Almaty+06:00US/Alaska-09:00Asia/Dubai+04:00Europe/Isle_of_ManZAmerica/Araguaina-03:00Cuba-05:00Asia/Novosibirsk+07:00America/Argentina/Salta-03:00Etc/GMT+3-03:00Africa/Tunis+01:00Etc/GMT+2-02:00Etc/GMT+1-01:00Pacific/Fakaofo+13:00Africa/Tripoli+02:00Etc/GMT+0ZIsrael+02:00Africa/BanjulZEtc/GMT+7-07:00Indian/Comoro+03:00Etc/GMT+6-06:00Etc/GMT+5-05:00Etc/GMT+4-04:00Pacific/Port_Moresby+10:00US/Arizona-07:00Antarctica/Syowa+03:00Indian/Reunion+04:00Pacific/Palau+09:00Europe/Kaliningrad+02:00America/Montevideo-03:00Africa/Windhoek+02:00Asia/Karachi+05:00Africa/Mogadishu+03:00Australia/Perth+08:00Brazil/East-03:00Etc/GMTZAsia/Chita+09:00Pacific/Easter-05:00Antarctica/Davis+07:00Antarctica/McMurdo+13:00Asia/Macao+08:00America/Manaus-04:00Africa/FreetownZEurope/Bucharest+02:00Asia/Tomsk+07:00America/Argentina/Mendoza-03:00Asia/Macau+08:00Europe/Malta+01:00Mexico/BajaSur-07:00Pacific/Tahiti-10:00Africa/Asmera+03:00Europe/Busingen+01:00America/Argentina/Rio_Gallegos-03:00Africa/Malabo+01:00Europe/Skopje+01:00America/Catamarca-03:00America/Godthab-03:00Europe/Sarajevo+01:00Australia/ACT+11:00GB-EireZAfrica/Lagos+01:00America/Cordoba-03:00Europe/Rome+01:00Asia/Dacca+06:00Indian/Mauritius+04:00Pacific/Samoa-11:00America/Regina-06:00America/Fort_Wayne-05:00America/Dawson_Creek-07:00Africa/Algiers+01:00Europe/Mariehamn+02:00America/St_Johns-03:30America/St_Thomas-04:00Europe/Zurich+01:00America/Anguilla-04:00Asia/Dili+09:00America/Denver-07:00Africa/BamakoZEurope/Saratov+04:00GBZMexico/General-06:00Pacific/Wallis+12:00Europe/Gibraltar+01:00Africa/ConakryZAfrica/Lubumbashi+02:00Asia/Istanbul+03:00America/Havana-05:00NZ-CHAT+13:45Asia/Choibalsan+08:00America/Porto_Acre-05:00Asia/Omsk+06:00Europe/Vaduz+01:00US/Michigan-05:00Asia/Dhaka+06:00America/Barbados-04:00Europe/Tiraspol+02:00Atlantic/Cape_Verde-01:00Asia/Yekaterinburg+05:00America/Louisville-05:00Pacific/Johnston-10:00Pacific/Chatham+13:45Europe/Ljubljana+01:00America/Sao_Paulo-03:00Asia/Jayapura+09:00America/Curacao-04:00Asia/Dushanbe+05:00America/Guyana-04:00America/Guayaquil-05:00America/Martinique-04:00PortugalZEurope/Berlin+01:00Europe/Moscow+03:00Europe/Chisinau+02:00America/Puerto_Rico-04:00America/Rankin_Inlet-06:00Pacific/Ponape+11:00Europe/Stockholm+01:00Europe/Budapest+01:00America/Argentina/Jujuy-03:00Australia/Eucla+08:45Asia/Shanghai+08:00UniversalZEurope/Zagreb+01:00America/Port_of_Spain-04:00Europe/Helsinki+02:00Asia/Beirut+02:00Asia/Tel_Aviv+02:00Pacific/Bougainville+11:00US/Central-06:00Africa/Sao_TomeZIndian/Chagos+06:00America/Cayenne-03:00Asia/Yakutsk+09:00Pacific/Galapagos-06:00Australia/North+09:30Europe/Paris+01:00Africa/Ndjamena+01:00Pacific/Fiji+12:00America/Rainy_River-06:00Indian/Maldives+05:00Australia/Yancowinna+10:30SystemV/AST4-04:00Asia/Oral+05:00America/Yellowknife-07:00Pacific/Enderbury+13:00America/Juneau-09:00Australia/Victoria+11:00America/Indiana/Vevay-05:00Asia/Tashkent+05:00Asia/Jakarta+07:00Africa/Ceuta+01:00Asia/Barnaul+07:00America/Recife-03:00America/Buenos_Aires-03:00America/Noronha-02:00America/Swift_Current-06:00Australia/Adelaide+10:30America/Metlakatla-09:00Africa/Djibouti+03:00America/Paramaribo-03:00Asia/Qostanay+06:00Europe/Simferopol+03:00Europe/Sofia+02:00Africa/NouakchottZEurope/Prague+01:00America/Indiana/Vincennes-05:00Antarctica/Mawson+05:00America/Kralendijk-04:00Antarctica/TrollZEurope/Samara+04:00Indian/Christmas+07:00America/Antigua-04:00Pacific/Gambier-09:00America/Indianapolis-05:00America/Inuvik-07:00America/Iqaluit-05:00Pacific/Funafuti+12:00UTCZAntarctica/Macquarie+11:00Canada/Pacific-08:00America/Moncton-04:00Africa/Gaborone+02:00Pacific/Chuuk+10:00Asia/Pyongyang+09:00America/St_Vincent-04:00Asia/Gaza+02:00Etc/UniversalZPST8PDT-08:00Atlantic/FaeroeZAsia/Qyzylorda+05:00Canada/Newfoundland-03:30America/Kentucky/Louisville-05:00America/Yakutat-09:00Asia/Ho_Chi_Minh+07:00Antarctica/Casey+08:00Europe/Copenhagen+01:00Africa/Asmara+03:00Atlantic/Azores-01:00Europe/Vienna+01:00ROK+09:00Pacific/Pitcairn-08:00America/Mazatlan-07:00Australia/Queensland+10:00Pacific/Nauru+12:00Europe/Tirane+01:00Asia/Kolkata+05:30SystemV/MST7-07:00Australia/Canberra+11:00MET+01:00Australia/Broken_Hill+10:30Europe/Riga+02:00America/Dominica-04:00Africa/AbidjanZAmerica/Mendoza-03:00America/Santarem-03:00Kwajalein+12:00America/Asuncion-03:00Asia/Ulan_Bator+08:00NZ+13:00America/Boise-07:00Australia/Currie+11:00EST5EDT-05:00Pacific/Guam+10:00Pacific/Wake+12:00Atlantic/Bermuda-04:00America/Costa_Rica-06:00America/Dawson-08:00Asia/Chongqing+08:00EireZEurope/Amsterdam+01:00America/Indiana/Knox-06:00America/North_Dakota/Beulah-06:00Africa/AccraZAtlantic/FaroeZMexico/BajaNorte-08:00America/Maceio-03:00Etc/UCTZPacific/Apia+14:00GMT0ZAmerica/Atka-10:00Pacific/Niue-11:00Australia/Lord_Howe+11:00Europe/DublinZPacific/Truk+10:00MST7MDT-07:00America/Monterrey-06:00America/Nassau-05:00America/Jamaica-05:00Asia/Bishkek+06:00America/Atikokan-05:00Atlantic/Stanley-03:00Australia/NSW+11:00US/Hawaii-10:00SystemV/CST6-06:00Indian/Mahe+04:00Asia/Aqtobe+05:00America/Sitka-09:00Asia/Vladivostok+10:00Africa/Libreville+01:00Africa/Maputo+02:00ZuluZAmerica/Kentucky/Monticello-05:00Africa/El_Aaiun+01:00Africa/OuagadougouZAmerica/Coral_Harbour-05:00Pacific/Marquesas-09:30Brazil/West-04:00America/Aruba-04:00America/North_Dakota/Center-06:00America/Cayman-05:00Asia/Ulaanbaatar+08:00Asia/Baghdad+03:00Europe/San_Marino+01:00America/Indiana/Tell_City-06:00America/Tijuana-08:00Pacific/Saipan+10:00SystemV/YST9-09:00Africa/Douala+01:00America/Chihuahua-07:00America/Ojinaga-07:00Asia/Hovd+07:00America/Anchorage-09:00Chile/EasterIsland-05:00America/Halifax-04:00Antarctica/Rothera-03:00America/Indiana/Indianapolis-05:00US/Mountain-07:00Asia/Damascus+02:00America/Argentina/San_Luis-03:00America/Santiago-03:00Asia/Baku+04:00America/Argentina/Ushuaia-03:00Atlantic/ReykjavikZAfrica/Brazzaville+01:00Africa/Porto-Novo+01:00America/La_Paz-04:00Antarctica/DumontDUrville+10:00Asia/Taipei+08:00Antarctica/South_Pole+13:00Asia/Manila+08:00Asia/Bangkok+07:00Africa/Dar_es_Salaam+03:00Poland+01:00Atlantic/MadeiraZAntarctica/Palmer-03:00America/Thunder_Bay-05:00Africa/Addis_Ababa+03:00Asia/Yangon+06:30Europe/Uzhgorod+02:00Brazil/DeNoronha-02:00Asia/Ashkhabad+05:00Etc/ZuluZAmerica/Indiana/Marengo-05:00America/Creston-07:00America/Punta_Arenas-03:00America/Mexico_City-06:00Antarctica/Vostok+06:00Asia/Jerusalem+02:00Europe/Andorra+01:00US/Samoa-11:00PRC+08:00Asia/Vientiane+07:00Pacific/Kiritimati+14:00America/Matamoros-06:00America/Blanc-Sablon-04:00Asia/Riyadh+03:00IcelandZPacific/Pohnpei+11:00Asia/Ujung_Pandang+08:00Atlantic/South_Georgia-02:00Europe/LisbonZAsia/Harbin+08:00Europe/Oslo+01:00Asia/Novokuznetsk+07:00CST6CDT-06:00Atlantic/CanaryZAmerica/Knox_IN-06:00Asia/Kuwait+03:00SystemV/HST10-10:00Pacific/Efate+11:00Africa/LomeZAmerica/Bogota-05:00America/Menominee-06:00America/Adak-10:00Pacific/Norfolk+12:00Europe/Kirov+03:00America/Resolute-06:00Pacific/Tarawa+12:00Africa/Kampala+03:00Asia/Krasnoyarsk+07:00GreenwichZSystemV/EST5-05:00America/Edmonton-07:00Europe/Podgorica+01:00Australia/South+10:30Canada/Central-06:00Africa/Bujumbura+02:00America/Santo_Domingo-04:00US/Eastern-05:00Europe/Minsk+03:00Pacific/Auckland+13:00Africa/Casablanca+01:00America/Glace_Bay-04:00Canada/Eastern-05:00Asia/Qatar+03:00Europe/Kiev+02:00Singapore+08:00Asia/Magadan+11:00SystemV/PST8-08:00America/Port-au-Prince-05:00Europe/BelfastZAmerica/St_Barthelemy-04:00Asia/Ashgabat+05:00Africa/Luanda+01:00America/Nipigon-05:00Atlantic/Jan_Mayen+01:00Brazil/Acre-05:00Asia/Muscat+04:00Asia/Bahrain+03:00Europe/Vilnius+02:00America/Fortaleza-03:00Etc/GMT0ZUS/East-Indiana-05:00America/Hermosillo-07:00America/Cancun-05:00Africa/Maseru+02:00Pacific/Kosrae+11:00Africa/Kinshasa+01:00Asia/Kathmandu+05:45Asia/Seoul+09:00Australia/Sydney+11:00America/Lima-05:00Australia/LHI+11:00America/St_Lucia-04:00Europe/Madrid+01:00America/Bahia_Banderas-06:00America/Montserrat-04:00Asia/Brunei+08:00America/Santa_Isabel-08:00Canada/Mountain-07:00America/Cambridge_Bay-07:00Asia/Colombo+05:30Australia/West+08:00Indian/Antananarivo+03:00Australia/Brisbane+10:00Indian/Mayotte+03:00US/Indiana-Starke-06:00Asia/Urumqi+06:00US/Aleutian-10:00Europe/Volgograd+04:00America/Lower_Princes-04:00America/Vancouver-08:00Africa/Blantyre+02:00America/Rio_Branco-05:00America/DanmarkshavnZAmerica/Detroit-05:00America/Thule-04:00Africa/Lusaka+02:00Asia/Hong_Kong+08:00Iran+03:30America/Argentina/La_Rioja-03:00Africa/DakarZSystemV/CST6CDT-06:00America/Tortola-04:00America/Porto_Velho-04:00Asia/Sakhalin+11:00Etc/GMT+10-10:00America/Scoresbysund-01:00Asia/Kamchatka+12:00Asia/Thimbu+06:00Africa/Harare+02:00Etc/GMT+12-12:00Etc/GMT+11-11:00Navajo-07:00America/Nome-09:00Europe/Tallinn+02:00Turkey+03:00Africa/Khartoum+02:00Africa/Johannesburg+02:00Africa/Bangui+01:00Europe/Belgrade+01:00Jamaica-05:00Africa/BissauZAsia/Tehran+03:30WETZEurope/Astrakhan+04:00Africa/Juba+03:00America/Campo_Grande-04:00America/Belem-03:00Etc/GreenwichZAsia/Saigon+07:00America/Ensenada-08:00Pacific/Midway-11:00America/Jujuy-03:00Africa/TimbuktuZAmerica/Bahia-03:00America/Goose_Bay-04:00America/Virgin-04:00America/Pangnirtung-05:00Asia/Katmandu+05:45America/Phoenix-07:00Africa/Niamey+01:00America/Whitehorse-08:00Pacific/Noumea+11:00Asia/Tbilisi+04:00America/Montreal-05:00Asia/Makassar+08:00America/Argentina/San_Juan-03:00Hongkong+08:00UCTZAsia/Nicosia+02:00America/Indiana/Winamac-05:00SystemV/MST7MDT-07:00America/Argentina/ComodRivadavia-03:00America/Boa_Vista-04:00America/Grenada-04:00Asia/Atyrau+05:00Australia/Darwin+09:30Asia/Khandyga+09:00Asia/Kuala_Lumpur+08:00Asia/Famagusta+02:00Asia/Thimphu+06:00Asia/Rangoon+06:30Europe/Bratislava+01:00Asia/Calcutta+05:30America/Argentina/Tucuman-03:00Asia/Kabul+04:30Indian/Cocos+06:30Japan+09:00Pacific/Tongatapu+13:00America/New_York-05:00Etc/GMT-12+12:00Etc/GMT-11+11:00Etc/GMT-10+10:00SystemV/YST9YDT-09:00Europe/Ulyanovsk+04:00Etc/GMT-14+14:00Etc/GMT-13+13:00W-SU+03:00America/Merida-06:00EET+02:00America/Rosario-03:00Canada/Saskatchewan-06:00America/St_Kitts-04:00Arctic/Longyearbyen+01:00America/Fort_Nelson-07:00America/Caracas-04:00America/Guadeloupe-04:00Asia/Hebron+02:00Indian/Kerguelen+05:00SystemV/PST8PDT-08:00Africa/MonroviaZAsia/Ust-Nera+10:00Egypt+02:00Asia/Srednekolymsk+11:00America/North_Dakota/New_Salem-06:00Asia/Anadyr+12:00Australia/Melbourne+11:00Asia/Irkutsk+08:00America/Shiprock-07:00America/Winnipeg-06:00Europe/Vatican+01:00Asia/Amman+02:00Etc/UTCZSystemV/AST4ADT-04:00Asia/Tokyo+09:00America/Toronto-05:00Asia/Singapore+08:00Australia/Lindeman+10:00America/Los_Angeles-08:00SystemV/EST5EDT-05:00Pacific/Majuro+12:00America/Argentina/Buenos_Aires-03:00Europe/Nicosia+02:00Pacific/Guadalcanal+11:00Europe/Athens+02:00US/Pacific-08:00Europe/Monaco+01:00
如何修改Linux服务器时间,到此就结束了,感谢大家阅读,如果文章对你有帮助 , 欢迎关注、点赞、收藏(一键三连)
版权归原作者 ζ小菜鸡 所有, 如有侵权,请联系我们删除。