Home > Article > Operation and Maintenance > How to set the time zone in linux
Method: 1. Execute the tzselect command in the terminal; 2. Select the "Asia" - "China" - "Beijing Time" - "yes" items in sequence; 3. Execute "TZ='Asia/Shanghai'; export TZ" command and add it to ".profile" and log in again.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to set the time zone in Linux
#When starting to set the time zone, refer to the information on the Internet and use the tzselect command. It turns out that the tzselect command is just It tells you how to set the time zone without actually modifying the /etc/sysconfig/clock file.
In other words, the tzselect command only tells us the time zone selected by setting the TZ environment variable, and then adds the variable to the .profile file. The following is a brief introduction on how to use the tzselect command to set the time zone, and how to set the time zone by modifying the /etc/sysconfig/clock configuration file.
tzselect:
Execute the tzselect command-->Select Asia-->Select China-->Select east China - Beijing, Guangdong, Shanghai, etc-->Then enter 1. The process is as shown below:
# After executing the tzselect command After selecting the time zone, the time zone has not changed. It only prompts at the end of the command that you can execute TZ='Asia/Shanghai'; export TZ and add this line of command to the .profile, then log out and log in again. Refer to the results seen by the date command in the figure below. The final time zone is displayed as CST, which is China Standard Time. Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to set the time zone in linux. For more information, please follow other related articles on the PHP Chinese website!