Linux Time Management

Source: Internet
Author: User

Linux time is divided into 2 kinds, one is hardware time RTC, one is the system time, after Linux boot, read the hardware time, read the success of no longer use this time, the kernel itself through the software mode to simulate the oscillator in the system to maintain the clock

commands for viewing and setting time have date, hwclock, clock, and hwclock and clock usage are similar


System time view, set command: Date

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7A/FE/wKioL1bEbtHCM5m0AAAg5Oy7wvo986.png "title=" Qq201602172058041111.png "alt=" Wkiol1bebthcm5m0aaag5oy7wvo986.png "/>

Options:

-D string displays the time of the string description

-S string to set the time to string description

Parameters:

[+format] Show time date format

%Y Full year

The last 2 digits of the%y year

%m Month (01-12)

%d date, the day ordinal of the month

%H hours, 24-hour (00-23)

%I Hours, 12-hour (01-12)

%k hours, 24-hour (0-23)

%l hours, 12-hour (1-12)

%M min (00-59)

%s seconds (00-59)

%Z Time Zone

%p Show AM or PM

%s from January 1, 1970 00:00:00 to the number of seconds currently experienced

%j Day of the Year (001-366)

%x,%d Date (MM/DD/YY)

%r display time, 12-hour system (HH:MM:SS)

%T display time, 24-hour system (HH:MM:SS)

%n Next Line

%t Skip a tab

Display time:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7B/11/wKiom1bGX4fxguAQAAAcoacIAjQ529.png "title=" Qq201602190819041111.png "alt=" Wkiom1bgx4fxguaqaaacoaciajq529.png "/>

There is a space between the parameters with quotation marks

Option-d:650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7B/11/wKioL1bGYvqDT-AMAABAbw1LAh4163.png "title=" Qq201602190831552222.png "alt=" Wkiol1bgyvqdt-amaababw1lah4163.png "/>

Set Time:

Date 011908402016.30 format: Month day hour minute year. seconds

Date-s set the current time, only the root privileges can be set, others can only view

Date-s 20160211 Set Month day, and will change the specific time to empty 00::0:00

Date-s 01:01:01 set time, no changes made to the date

Date-s "01:01:01 20160211" set all time

Date-s "01:01:01 2016-02-11" set all time

Date-s "20160211 01:01:01" set all time


Hardware time view, set command: Hwclock, clock

Hwclock is similar to clock usage, except that the clock command supports the Alpha hardware system in addition to the x86 hardware body.

Command Hwclock:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7B/11/wKiom1bGbIXy808yAABFiY2dF38668.png "title=" Qq20160219091420121212.png "alt=" Wkiom1bgbixy808yaabfiy2df38668.png "/>

Options:

-R,--show displays the time of the hardware clock

-S,--hctosys adjusts the system clock to be the same as the hardware clock

-W,--SYSTOHC adjusts the hardware clock to the same as the system clock

--set--date=newdate Setting Hardware clock

To set the hardware clock:

Hwclock--set--date= "2/19/2016 09:39:33"

Linux Time Management

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.