06- Time Management

 1 [root@localhost ~]# stat anaconda-ks.cfg 
 2   File: ‘anaconda-ks.cfg’
 3   Size: 1854          Blocks: 8          IO Block: 4096   regular file
 4 Device: fd00h/64768d    Inode: 33574978    Links: 1
 5 Access: (0670/-rw-rwx---)  Uid: (    0/    root)   Gid: (    0/    root)
 6 Context: system_u:object_r:admin_home_t:s0
 7 Access: 2019-08-10 20:11:22.311000230 +0800
 8 Modify: 2019-08-10 20:10:06.757030040 +0800
 9 Change: 2019-08-10 22:35:19.830068534 +0800
10  Birth: -
Three time attributes: 
  Access: (Access Time), abbreviated as atime, represents an access time of the file (see, change will occur when accessing)

cat  

  Modify: (Modify Time), abbreviated as mtime, modification time represents the contents of the file (occurs when file content changes more to that content block change)
  

vi 
  Change: (Change Time), abbreviated as ctime, represents the modification time (file permissions file status, owner, group it belongs to, change will occur when the number of links is changed; when the content changes will change ( That content is changed and inode Block content will change when the change occurs)

chown 


time management command: date
  display time: date
  display time specified format: date + "format"
    
 1 [root@localhost ~]# date +"%Y-%m-%d"
 2 2019-08-11
 3 [root@localhost ~]# date +"%Y-%m-%d *m:%h"
 4 2019-08-11 *m:Aug
 5 [root@localhost ~]# date +"%Y-%m-%d %m:%h"
 6 2019-08-11 08:Aug
 7 [root@localhost ~]# date +"%Y-%m-%d %M:%h"
 8 2019-08-11 07:Aug
 9 [root@localhost ~]# date +"%Y-%m-%d %M:%H"
10 2019-08-11 07:18

  Set time: date -s "Time"

1 [root@localhost ~]# date -s "2018-9-10"
2 Mon Sep 10 00:00:00 CST 2018
3 [root@localhost ~]# date -s "2018-9-10 10:00:00"
4 Mon Sep 10 10:00:00 CST 2018
5 [root@localhost ~]# date -s "10:00:50"
6 Mon Sep 10 10:00:50 CST 2018
7 [root@localhost ~]# date -s "10:00:50 2019-8-11"
8 Sun Aug 11 10:00:50 CST 2019

linux time there is more than date, that is, the system time (sys time), there is a time hardware (BIOS time)

  Display hardware time: hwclock

  How hardware and system time synchronization?

    hwclock --help   

      -s, --hctosys set the system time from the hardware clock to the hardware clock is synchronized to the system clock
      -w, --systohc set the hardware clock from the current system time clock is synchronized to the system hardware clock

If you have more than one PC in the LAN or want more than one computer time highly consistent, you can use the Network Time Protocol:

  ntp (6.x version), chrony (7.x version)

NTP (Network Time Protocol, Network Time Protocol) is used to make the various computers in a network time protocol to synchronize.

Its purpose is to synchronize the computer's clock to UTC UTC with an accuracy of up to 0.1ms in the LAN, the vast majority of places on the Internet its accuracy can reach 1-50ms.

 

 

Guess you like

Origin www.cnblogs.com/zzzhbr/p/11334082.html