Operations 4 min read

Set Linux Timezone to CST (Asia/Shanghai) with timedatectl and Manual Links

Learn step-by-step how to change a Linux system’s timezone to China Standard Time (CST, Asia/Shanghai) using the modern timedatectl command, creating a symbolic link to /etc/localtime, or setting the TZ environment variable for temporary adjustments, with verification commands and important cautions.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Set Linux Timezone to CST (Asia/Shanghai) with timedatectl and Manual Links

Method 1: Using timedatectl (recommended)

Check the current timezone timedatectl The output shows fields such as Local time , Universal time and Time zone . If the system is already set to China Standard Time you will see Time zone: Asia/Shanghai (CST, +0800) .

List available zones timedatectl list-timezones | grep Shanghai The command should list Asia/Shanghai among the results.

Set the timezone to CST sudo timedatectl set-timezone Asia/Shanghai Verify the change timedatectl The Time zone line must now read Asia/Shanghai (CST, +0800) .

Method 2: Manual symlink of /etc/localtime

Backup the existing file sudo mv /etc/localtime /etc/localtime.bak Create a symbolic link to the Shanghai zone data

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

Verify the result date The displayed time should correspond to GMT+8 (China Standard Time).

Method 3: Temporary TZ environment variable

Export the variable for the current shell session: export TZ="Asia/Shanghai" Check the effect with date. The setting disappears after the session ends or the system reboots.

Important notes

Prefer timedatectl on modern Linux distributions because it updates the system clock configuration atomically.

The hardware clock (UTC) should be correct; changing the timezone only affects how timestamps are presented to users.

The manual /etc/localtime symlink method is useful for older distributions that lack systemd or the timedatectl command.

Using the TZ variable is suitable for temporary adjustments, scripts, or container environments where a permanent change is not desired.

Source: https://www.cnblogs.com/guowenrui/p/18577526
LinuxTimezonetimedatectlCST
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.