Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the date command to display hardware time in ubuntu

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Ubuntu how to use the date command to display hardware time, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

1. Date command is mainly used to display and modify system time.

2. The hwclock command is used to view the set hardware time and synchronize the hardware time with the system time.

The code is as follows:

# display hardware time hwclock

# set hardware time hwclock-set-date= "03Uniqqqqr 14 22:22:00"

# synchronize the hardware clock with the system clock hwclock-hctosys

# synchronize the system clock with the hardware clock hwclock-systohc

3. Ntpdate is used to synchronize network time

The code is as follows:

Ntpdate cn.pool.ntp.org

4. Modify time zone tzselect command, navigate to select time zone sudo cp / usr/share/zoneinfo/Asia/ShangHai / etc/localtime

5. Change Locale modify / var/lib/locales/supported.d/local for example:

The code is as follows:

En_US.UTF-8 UTF-8zh_CN.UTF-8 UTF-8zh_CN.GBK GBKzh_CN GB2312

Then run locale-gen or sudo dpkg-reconfigure locales

Locale sets the Locale of the rule Ubuntu into 12 categories, that is, 12 LC_*. In addition to the 12 variables that can be set, there are two variables for simplicity: LC_ALL and LANG. There is a priority relationship between them:

LC_ALL > LC_* > LANG

It can be said that LC_ALL is the highest or mandatory setting, while LANG is the default setting. If you set LC_ALL=zh_CN.UTF-8, no matter what value LC_* and LANG are set to, they will be forced to obey the setting of LC_ALL and become zh_CN.UTF-8. If you set LANG=zh_CN.UTF-8 and other LC_*=en_US.UTF-8, and do not set LC_ALL, then the system locale is set to LC_*=en_US.UTF-8. If you set LANG=zh_CN.UTF-8 and other LC_*, and LC_ALL are not set, the system will set LC_* to the default value, that is, zh_CN.UTF-8, the value of LANG. If you set LANG=zh_CN.UTF-8, but other LC_CTYPE=en_US.UTF-8, other LC_*, and LC_ALL are not set, then the locale setting of the system will be: LC_CTYPE=en_US.UTF-8, the rest of LC_COLLATE,LC_MESSAGES and so on will use the default value, that is, the value of LANG, that is, LC_COLLATE=LC_MESSAGES=. = LC_PAPER=LANG=zh_CN.UTF-8. All in all, the rules for setting locale are:

If you need a Chinese-only system, you can set either LC_ALL= zh_CN.XXXX or LANG= zh_CN.XXXX, of course you can set both, but as mentioned above, the value of LC_ALL will override all other locale settings. If you only want an environment where you can enter Chinese, and keep the menu, title, system information, etc., as the English interface, then you only need to set LC_CTYPE=zh_CN.XXXX,LANG=en_US.XXXX. So LC_CTYPE=zh_CN.XXXX, and LC_COLLATE=LC_MESSAGES=. = LC_PAPER=LANG=en_US.XXXX.

Finally, 12 types of Locale are attached:

LC_CTYPE= "en_US.UTF-8" LC_NUMERIC= "en_US.UTF-8" LC_TIME= "en_US.UTF-8" LC_COLLATE= "en_US.UTF-8" LC_MONETARY= "en_US.UTF-8" LC_MESSAGES= "en_US.UTF-8" LC_PAPER= "en_US.UTF-8" LC_NAME= "en_US.UTF-8" LC_ADDRESS= "en_US.UTF-8" LC_TELEPHONE= "en_US.UTF-8" Does LC_MEASUREMENT= "en_US.UTF-8" LC_IDENTIFICATION= "en_US.UTF-8" help you after reading the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report