2

I have set the date & time but once I logout, it sets time back to old time slot.

How can I set the time permanently? I have used the tzselect command & then export localtime.

closed as unclear what you're asking by Gilles, Jeff Schaller, Anthon, Stephen Harris, cas Aug 13 '16 at 15:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    which Linux OS do you have ? – Rahul Aug 11 '16 at 11:13
  • 2
    do you actually want to set date & time or do you want to change the timezone? if the former, to what date and time does your machine set it back to? – madeddie Aug 11 '16 at 11:37
  • Are you booting from a recovery or installation media, or from a hard / SSD drive? – Julie Pelletier Aug 13 '16 at 3:57
3

If systemd based system, here you are ↴

Date and Time

$ timedatectl set-time 'YYYY-MM-DD HH:MM:SS'

And if you want to change the date or time only:

$ timedatectl set-time HH:MM:SS       /*for time only*/

$ timedatectl set-time YYYY-MM-DD     /*for date only*/

To verify the change:

$ timedatectl

To print the system date and time:

$ date

TimeZone

You can use timedatectl as shown below to list the available timezones

$ timedatectl list-timezones

To select one:

$ timedatectl set-timezone 'yourNewTimeZone' 

N.B. And if you want to use tzselect, be aware that for the change to be permanent, you need to add your export-line - for instance TZ='yourNewTimeZone'; export TZ in $HOME/.bash_profile or $HOME/.bashrc. BTW, be aware that tzselect command does not actually change the timezone for you.

Not the answer you're looking for? Browse other questions tagged or ask your own question.