Configure localtime. dpkg-reconfigure tzdata
I'm assuming you want to change the timezone by one shell command.
Do you have timedatectl
on your system?
If so:
timedatectl status
will show your current settings.
timedatectl list-timezones
shows available timezones.
timedatectl set-timezone Antarctica/Mawson
sets it.
Note: If the RTC is configured to be in the local time, this will also update the RTC time.
Is there true way without user ncurses interface?
echo Antarctica/Mawson >/etc/timezone
dpkg-reconfigure -f noninteractive tzdata
Yes, you can create one shell command:
sh -c 'echo Antarctica/Mawson >/etc/timezone && dpkg-reconfigure -f noninteractive tzdata'
:)
There is a bug in tzdata
: certain values get normalized by dpkg-reconfigure
:
echo 'US/Central' >/etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Current default time zone: 'America/Chicago'
echo 'US/Eastern' >/etc/timezone
apt-get install --reinstall tzdata
# Current default time zone: 'America/New_York'