In this article, I will introduce to you several ways to check the Linux time zone. Time zone management is very important on Linux devices, especially on production servers.
The following will introduce in detail how to view.
First, we turn on the linux system and log in with the root account, and then we introduce the first method,
To use the date command, first we enter the "date" command in the terminal to view the system time zone,
The specific display is shown in the figure below.
Then we can further use the date command parameter to show the time zone used by the system in more detail. %Z can output the time zone in character form.
%z can output the time zone in digital form. We execute the command "date +"%Z %z"", the specific display is shown in the figure below.
Of course, if we want to know more about the use of the date command, we can use the command "date --help" to view the help document,
The details are shown in the figure below.
Then we introduce another way of viewing, using the command timedatectl, we execute the command "timedatectl | grep "Time zone"" to view the result display,
The specific display is shown in the figure below.
Of course, if we want to view all time zones, we can enter the directory "/usr/share/zoneinfo/" to view them.
The specific display is shown in the figure below.
If we want to modify the time zone, this article introduces a method to use the tzselect command to operate, we enter the command "tzselect",
First choose the state, we choose 5, Asia. The specific display is shown in the figure below.
Then in Select Country, we enter 9, select china,
The specific display is shown in the figure below.
Then at the time zone selection, we select the beijing time zone,
The specific operation is shown in the figure below.
Finally, confirm our input, and the time zone setting is now complete.
Original address: https://jingyan.baidu.com/article/a3aad71af41ea8b1fb0096ec.html
The above is the Linux-related knowledge shared by Liangxu Tutorial Network for all friends.