How To Set Date In Linux Using Command Line

First of all, you can check the time and date using the date command in Linux. how to set or change date and time using timezone file location in Linux.

how to set date

Check Out: Step To Create Users And Set Password In Ubuntu

This is set to India standard time and date format is date +%Y%m%d

date +%Y%m%d -s ‘20200212’

linux timezone file location

Set the time with format date +%T -s ‘HH:MM:SS’

date +%T -s ’14:20:00′

change timezone linux

Check Out: How To Check Currently Logged-In User In Linux System

you can also set date and time using the below command as well.

date -s '19 January 2020 14:11:00'

set date and time

If you want to change your region, you can find this file on the server at this location /usr/share/zoneinfo

linux set date timezone

You can right the timezone for you according to your location or needs. You will have to remove this file localtime from /etc/localtime. If you require to change it to another region.

rm -rf /etc/locatime

ln -s /usr/share/zoneinfo/America/Chicago /etc/locatime

Check Out: Configure Master and Slave MySQL Replication On Linux

Else, you can also use copy command instead of above command.so

cp /usr/share/zoneinfo/America/Chicago /etc/locatime

There’s a hardware clock that runs in your hardware even you’re disconnected from the power supply. so

hwclock –show

Check Out: Windows Screen lock Automatically Using Group Policy

You can set hwclock to your localtime. so

hwclock –set –date=’2020-04-12 15:45:05′ –localtime

Set it to UTC time. so

hwclock –set –date=’2020-04-12 15:45:05′ –utc

You’re done linux  change timezone file location set date and time how to

Leave a Reply

avatar
  Subscribe  
Notify of