UbuntuLinux system uses command line to modify the time zone

Source: Internet
Author: User
Article Title: The UbuntuLinux system uses command lines to modify the time zone. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

By default, Linux uses the UTC format as the standard time format. If you run a program in Linux and specify a different time zone in the program, a time error may occur. For Ubuntu Desktop, you can directly modify the time zone information in graphic mode. But for Server, you need to modify the time zone information through tzconfig. Usage (for example, set the time zone to Asia/Chongqing ):

Sudo tzconfig

Then follow the prompts to select the serial number corresponding to Asia. After the selection, a bunch of new prompts will be displayed-enter the city name, such as Shanghai or Chongqing, finally, use sudo date-s "" to modify the local time.

During the operation, it is found that the Ubuntu7.10 Server does not support the tzconfig tool. In this case, you need to use tzselect to modify the time. The usage is similar to that of the tzconfig tool, the prompt information is slightly different from the selected information. (unlike tzconfig, You need to execute this command after setting: sudo cp/usr/share/zoneinfo/Asia/ShangHai/etc/localtime ). Example:

Tzselect

Select the time zone as prompted, and then:

Sudo cp/usr/share/zoneinfo/Asia/ShangHai/etc/localtime

Run

Sudo ntpdate cn.pool.ntp.org

Cn.pool.ntp.org is a public NTP server located in China. It is used to synchronize your time (If your time is different from the server's time cut, you may not be able to synchronize the time, even commands such as sudo reboot cannot be executed ).

Related Article

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.