6

Is there a way i can set the current timezone via the commandline/terminal? Its for a shelle script so im looking for some, hopefully, one liner like date -Z 'Europe/London' (Just an example), in other words just a command to write and not anyhting todo with graphics

Is there any built in way of doing it ?

5

This works on Linux Mint, Ubuntu, Debian, I think most Debian-based distros...

echo "America/Eastern" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata

Where to find timezones:

Or (as commented) use timedatectl list-timezones to find a zone, then timedatectl set-timezone [timezone]


If required, see this Debian page about Time Zone Changes. You could use the program zic along with changing some files, if you wanted to change the details of the time zone, like daylight savings time start & end dates, etc.

3

You can change it with more than one line. Exactly two lines.

  1. mv /etc/localtime /etc/localtime.old

and then Link your TimeZone file like this:

  1. ln -s /usr/share/zoneinfo/Europa/London /etc/localtime

You can check with date

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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