centos如何更换时区

centos的设置时区的方式的本质是创建软连接

比如说,一台服务器的时区不正确,查看一下:

[[email protected] project]# date
Tue Jun 11 23:42:26 EDT 2019
[[email protected] project]# ll /etc/localtime 
lrwxrwxrwx. 1 root root 38 Feb 17 04:59 /etc/localtime -> ../usr/share/zoneinfo/America/New_York

可以发现,连接的是美国纽约时间,现在更换成亚洲上海

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

确认一下

[[email protected] project]# ll /etc/localtime 
lrwxrwxrwx 1 root root 33 Jun 12 11:43 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai
[[email protected] project]# date
Wed Jun 12 11:44:03 CST 2019


现在时间就正确了

还有哪些时区呢:太多了

[[email protected] project]# ls /usr/share/zoneinfo/
Africa Australia Cuba Etc GMT-0 Indian Kwajalein Navajo posix ROK UTC
America Brazil EET Europe GMT+0 Iran Libya NZ posixrules Singapore WET
Antarctica Canada Egypt GB Greenwich iso3166.tab MET NZ-CHAT PRC Turkey W-SU
Arctic CET Eire GB-Eire Hongkong Israel Mexico Pacific PST8PDT UCT zone1970.tab
Asia Chile EST GMT HST Jamaica MST Poland right Universal zone.tab
Atlantic CST6CDT EST5EDT GMT0 Iceland Japan MST7MDT Portugal ROC US Zulu


[[email protected] project]# ls /usr/share/zoneinfo/Asia/
Aden Bahrain Chongqing Gaza Jerusalem Kuala_Lumpur Novokuznetsk Riyadh Tbilisi Urumqi
Almaty Baku Chungking Harbin Kabul Kuching Novosibirsk Saigon Tehran Ust-Nera
Amman Bangkok Colombo Hebron Kamchatka Kuwait Omsk Sakhalin Tel_Aviv Vientiane
Anadyr Barnaul Dacca Ho_Chi_Minh Karachi Macao Oral Samarkand Thimbu Vladivostok
Aqtau Beirut Damascus Hong_Kong Kashgar Macau Phnom_Penh Seoul Thimphu Yakutsk
Aqtobe Bishkek Dhaka Hovd Kathmandu Magadan Pontianak Shanghai Tokyo Yangon
Ashgabat Brunei Dili Irkutsk Katmandu Makassar Pyongyang Singapore Tomsk Yekaterinburg
Ashkhabad Calcutta Dubai Istanbul Khandyga Manila Qatar Srednekolymsk Ujung_Pandang Yerevan
Atyrau Chita Dushanbe Jakarta Kolkata Muscat Qyzylorda Taipei Ulaanbaatar
Baghdad Choibalsan Famagusta Jayapura Krasnoyarsk Nicosia Rangoon Tashkent Ulan_Bator

那有没有快速确定时区的方法,有的,命令是tzselect

可以看我之前的日志  https://www.fencatn.com/cloud/linux/centos时区查看命令/

 

此条目发表在LinuxBasic分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注