The correct way to modify the time zone for Linux
The CentOS and Ubuntu time zone files are/etc/localtime, but after CentOS7 localtime and become a link file
[Email protected] ~]# Ll/etc/localtime lrwxrwxrwx 1 root root on Oct 11:01/etc/localtime-/usr/share/zoneinfo/a Sia/shanghai
If you use the direct CP method to modify the system time zone, then it will be linked to the file changes, such as the United States time zone file changes to the content of the Shanghai time zone, may cause some programming languages or programs to read the system time zone error occurs, so the correct method is:
CentOS6, Ubuntu16
# Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
CentOS7, RHEL7, Scientific Linux 7, Oracle Linux 7
The best way is to use the TIMEDATECTL command
# timedatectl List-timezones |grep Shanghai #查找中国时区的完整名称Asia/shanghai# timedatectl set-timezone Asia/shanghai #其他时区以此类推
Or create a soft link directly manually
# Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime
Reprinted from: https://www.cnblogs.com/st-jun/p/7737188.html
Linux Time Zone modification