Guide |
Time management skills in Linux machines, especially on production servers, are an extremely important aspect of system management, so here we will introduce the time management under Linux. |
Linux contains a variety of time management tools available, such as date or timedatectlcommands, that you can use to get the current system time zone, or to synchronize the system times with the NTP server to automate and more accurately manage time. 1, we start with the traditional date command
Use the following command to see our current time zone:
$ date
Alternatively, you can use the following command. Where the%Z format can output time zones in the form of characters, and%Z output in digital form:
$ date + "%Z%Z"
Note: The date's hand album contains many output formats that you can use to replace the output of your date command:
$ man Date
2, Next, you can also use Timedatectl
When you run it without any parameters, this command can output the system time overview, which contains the current time zone, as shown in the following illustration:
$ timedatectl
You can then provide a pipe in the command, and then use the grep command to filter only the time zone information as follows:
$ timedatectl | grep "Time zone"
Again, we can learn how to use Timedatectl to set up the Linux time zone. 3, further, display the contents of the file/etc/timezone
displaying files using the Cat tool
/etc/timezone
To view your time zone:
$ cat/etc/timezone
For Rhel/centos/fedora users, here's another command that works the same way:
$ grep Zone/etc/sysconfig/clock
This article is reproduced from: http://www.linuxprobe.com/linux-timezone.html
Free to provide the latest Linux technology tutorials Books, for the open source technology enthusiasts to do more and better: http://www.linuxprobe.com/