Set Time, Date Timezone in Linux Command Line

Set Time, Date Timezone in Linux Command Line

It's very important to set correct time and date in Linux.various things only depend on this time zone. It's not a matter that you are using Linux server or Linux to your personal computer.it's always important to set the correct time on the server or on the clock.

Date Timezone in Linux from Command Line:
  • Set date from the command line
date +%Y%m%d -s "20120418"
  • Set time from the command line
date +%T -s "11:14:00"
  • Set time and date from the command line
date -s "19 APR 2012 11:14:00"
  • Linux check date from command line
  • Will show you something like this:
Thu Aug 19 15:17:34 BOT 2017
Set correct clock in your personal hardware:
Even you disconnect your pc hardware its clock is still running currently. it's running because you are using a lithium battery in the modern computers.

  • We'll see differences between hardware clock and system clock
hwclock –show
  • Will output something like this:
Thu 17Aug 2012 03:23:05 PM BOT -0.785086 seconds
  • Now check the system clock
  • Will output something like this:
Thu Apr 19 15:26:41 BOT 2012
  • Let's set the hardware clock to local time:
hwclock --set --date="2012-04-19 16:45:05" –localtime
  • If you want to set it to UTC time use:
hwclock --set --date="2011-04-19 20:45:05" --utc
Set the correct time zone:
To set the correct timezone in your system follow the given below code

cp /usr/share/zoneinfo/America/La_Paz /etc/localtime
Author
bhawanisingh
Views
2,057
First release
Last update
Rating
0.00 star(s) 0 ratings
Top