Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to view and modify the time zone in linux

Shulou Source: shulou.com Published: 2022-06-01 14:50:05 11月16日 Update

This article is about how to view and modify the time zone in linux. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

View and modify the time zone of Linux

1. View current time zone

Command: "date-R"

two。 Modify the setting of Linux server time zone

Method A

Command: "tzselect"

Method B is limited to RedHat Linux and CentOS

Command: "timeconfig"

Method C is suitable for Debian.

Command: "dpkg-reconfigure tzdata"

3. Copy the appropriate time zone file, replace the system time zone file, or create a link file

Cp / usr/share/zoneinfo/$ Primary time Zone / $Sub time Zone / etc/localtime

For example: use Asia / Shanghai (+ 8) in setting China time zone

Cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

II. Time to view and modify Linux

1. View time and date

Command: "date"

two。 Set time and date

For example: order to set the system date to November 3, 2009

Command: "date-s 11amp 03max 2009"

The command to set the system time to 05:55:55

Command: "date-s 17:55:55"

3. Write the current time and date to BIOS to avoid invalidation after restart

Command: "hwclock-w"

Note:

Date

The current date and time can be seen directly without parameters.

Cal

You can see this month's calendar directly without adding parameters.

The above is how to view the time zone and modify the time zone in linux. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Time zone command time date file method system parameter more knowledge article utility that is work meeting article calendar server look knowledge point industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi Linux MariaDB Docker