Home > Operation and Maintenance > Linux Operation and Maintenance > How to modify date and time in linux

How to modify date and time in linux

王林
Release: 2022-12-30 11:12:54
Original
40968 people have browsed it

How to modify the date and time in Linux: Execute the [date -s "Year-Month-Day Hour:Minute:Second"] command to successfully modify the date and time. If you want to check the time and date, just execute the [date] command directly.

How to modify date and time in linux

The operating environment of this article: red hat enterprise linux 6.1 system, thinkpad t480 computer.

(Learning video sharing: linux video tutorial)

How to modify and check the date and time:

1. Check the time, Date

# date
Fri Jan 11 14:04:10 CST 2019
Copy after login

2. Modification time

Syntax: date -s "hour:minute:second"

# date -s "17:20:30"
Copy after login

3.Modification date and time

Syntax :date -s "Year-Month-Day Hour:Minute:Second"

# date -s "2019-01-11 14:21:30"
Copy after login

Note: The setting time needs to be enclosed in double quotes, otherwise an error will be reported.

4. hwclock -w Write the time into the BIOS to avoid losing the set time after restarting the server.

# hwclock -w
Copy after login

Related recommendations: linux tutorial

The above is the detailed content of How to modify date and time in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template