Show & Set Date and Time by Command Prompt on Linux
By editor, 20 April, 2016
Question
How to set Date and Time on Linux (redhat, debian, umuntu, mint, centos ....) using shell command prompt?
To show the Date / Time on Linux
date
To show the hardware Clock (RTC) on Linux
hwclock -r
OR hwclock --show
OR show time in UTC (Coordinated Universal Time) hwclock --show --utc
To set the Set Date and Time using shell Command
date --set="STRING"
Examples: date -s "30 JAN 2016 12:00:00"
date --set="30 JAN 2016 12:00:00"
date +%Y%m%d -s "20160420"
date +%T -s "10:20:30"
date +%T%p -s "10:20:30AM"
date +%T%p -s "10:20:30PM"
To set the Hardware Clock (RTC) to the current System Time
Comments