Setting timezone from terminal

To change time zone from terminal, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo dpkg-reconfigure tzdata

Once open, just follow the screens to change the time zone.


You can also use the new timedatectl to set the time in 14.04.

sudo timedatectl set-timezone America/New_York

I realize this thread is a bit dated, but I was looking for a better solution because I needed to automatically set the timezone in a VM after a user downloads it from our website and deploys it. Here's what I ended up with:

echo "Setting TimeZone..."
export tz=`wget -qO - http://geoip.ubuntu.com/lookup | sed -n -e 's/.*<TimeZone>\(.*\)<\/TimeZone>.*/\1/p'` &&  timedatectl set-timezone $tz
export tz=`timedatectl status| grep Timezone | awk '{print $2}'`
echo "TimeZone set to $tz"

This will query geoip.ubuntu.com from the server once it is started on the new network (my script checks for connectivity first course) and then set the server's timezone based on the response.

The "wget -q0 -" tells wget to output only the results to stdout which is then piped to the $tz variable.

Hope it helps someone!


You can use the GMT±x files in /usr/share/zoneinfo/Etc.

sudo ln -fs /usr/share/zoneinfo/Etc/GMT$offset /etc/localtime

TL;DR /etc/localtime is a symbolic link that points to a file in /usr/share/zoneinfo/Continent/City. By altering where it points you can alter your timezone.

In order to change timezone, remove the /etc/localtime and assign symbolic link to your desired city. For instance, ls -l /etc/localtime reports that this file points to /usr/share/zoneinfo/America/Denver. To change it to New York, I do

  1. sudo rm /etc/localtime
  2. sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
  3. Wait a minute for my clock to get updated

The screenshot bellow shows the steps and confirmation from timedatectl

enter image description here