Linux View current time and modify system time

Source: Internet
Author: User
Tags time and date

One, view and modify the time zone of Linux 1. View current time zone

Command:

Date -R
2. Modify the setup Linux Server time zone method A

Command:

Tzselect
Method B is limited to Redhat Linux and CentOS

Command:

Timeconfig
Method C applies to Debian

Command:

Dpkg-reconfigure Tzdata
3. Copy the appropriate time zone file, replace the system time zone file, or create a linked file
CP /usr/share/zoneinfo/$ main time zone/$ times time zone/etc/localtime

For example: In set China time zone use Asia/Shanghai (+8)

CP /usr/share/zoneinfo/asia/shanghai/etc/localtime
Second, the time to view and modify Linux 1. View time and date

Command:

Date
2. Set the time and date

Example: Setting the system date to the November 3, 2009 command

Command:

Date One/all/

command to set the system time to 5:55 P.M. 55 seconds

Command:

Date ::
3. Write the current time and date to the BIOS to avoid failure after reboot

Command:

Hwclock-W

Note:

Date
Without parameters, you can see the current date and time directly.


Cal
Without parameters you can see this month's monthly calendar directly

At first, or on the Internet, for example, set the time to 2009-11-12 18:30:50.

We'll set the date first.
Date 20091112
Set the time again
Date :
A machine is OK to say, more you will be bored. Is there any way to one step? After several searches found!
Date 111218302009 (Month-day year)
This allows you to step in place. But! But what, for Linux, this writing is too human, too difficult to remember. Is there a simpler way? After groping, found, there!
Date " 20091112 18:30:50 "
This can be one step, and easy to remember. Stole the use of a long time, the general children I do not tell him, the virtual ~ time set up will be saved. If you're going to shut down normally, okay. The system will be saved once, but if you may not shut down properly, you can save the settings
Hwclock--SYSTOHC
Yes, that's the way it's written. Most of the online wording is
Clock-W or Hwclock-w
And you know carefully, the clock is Hwclock's soft link. Hwclock's help and man did not mention the-W parameter at all. I do not know what year-W is the wording. And most of the online article is-w:) The last summary, one step set the Linux system time:
Date " 20091112 18:30:50 " &&hwclock--SYSTOHC

Linux View current time and modify system time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.