Method: 1. Use the "date "%Z %z"" command to output the time zone in the form of characters and numbers; 2. Use the "timedatectl | grep "Time zone"" command to filter out the time zone information; 3. . Use the "cat /etc/timezone" command to view the file contents to output the time zone.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
1. Use the date command to obtain time zone information
Use the following command to take a look See our current time zone:
date
Alternatively, you can use the command below. Among them, the %Z format can output the time zone in character form, and %z outputs the time zone in numeric form:
date +"%Z %z"
Note: The date man page contains many output formats, you can Use them to replace the output of your date command:
man date
2. Use the timedatectl command to obtain time zone information
When you run it without any parameters, This command can output a system time overview as shown below, including the current time zone:
timedatectl
You can then provide a pipe in the command and use the grep command to filter out only the time zone as shown below Information:
timedatectl | grep "Time zone"
3. Display the contents of the file /etc/timezone to obtain the time zone information
Use the cat tool to display the file / etc/timezone to check your time zone:
cat /etc/timezone
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to query the time zone in linux. For more information, please follow other related articles on the PHP Chinese website!