2023-10-03 11:14:36 +08:00
|
|
|
|
---
|
|
|
|
|
title: CentOS系统时间和时区查看以及修改的方法
|
|
|
|
|
tags:
|
|
|
|
|
- centos
|
|
|
|
|
- VPS
|
|
|
|
|
excerpt: ''
|
|
|
|
|
categories: 分享
|
|
|
|
|
abbrlink: 8952
|
|
|
|
|
date: 2016-11-14 13:38:48
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
一、时间修改 远程连接到centos 或者直接登录系统
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
date
|
|
|
|
|
```
|
|
|
|
|
查看系统时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
date -s
|
|
|
|
|
```
|
|
|
|
|
修改时间 看下面的例子
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
date -s 03/04/2013
|
|
|
|
|
```
|
|
|
|
|
(将系统日期设定为2013年03月04日)
|
|
|
|
|
```
|
|
|
|
|
date -s 110:38
|
|
|
|
|
```
|
|
|
|
|
(将系统时间设定为上午 10:38)
|
|
|
|
|
|
|
|
|
|
二、时区修改
|
|
|
|
|
|
|
|
|
|
先查看时区
|
|
|
|
|
```
|
|
|
|
|
date -R
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
修改时区: (将Asia/shanghai-上海时区写入当前时区)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
提示是否覆盖,输入Y回车, 然后
|
|
|
|
|
```
|
|
|
|
|
date
|
|
|
|
|
```
|
2023-09-25 15:58:56 +08:00
|
|
|
|
查看时区和时间(CST,中国时区)
|