Change the timezone

To update the timezone, you have to change two files:

  • /etc/localtime
  • /etc/timezone

Localtime

Change the /etc/localtime file to link to the correct timezone.

sudo unlink /etc/localtime
sudo ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
BASH

Check the new configuration with the date program:

date
BASH

Output

Fri Oct  4 09:50:04 CEST 2019
BASH

Timezone

Change the /etc/timezone files content to the selected timezone. The file content corresponds to the path of the zoneinfo file, relative to the /usr/share/zoneinfo folder.

sudo echo "Europe/Paris" > /etc/timezone
BASH

You can check the new timezone configuration with the manager:

manager system time timezone
CODE

Timezone location

The timezone configuration is stored in two parallel locations:

  • /etc/localtime
  • /etc/timezone

Both files should be configure for the same timezone to have a consistent system.

Localtime

The /etc/localtime file is a symbolic link to the currently configured timezone:

ls -l /etc/localtime
BASH

Output

lrwxrwxrwx 1 root root 29 Oct 2 14:54 /etc/localtime -> /usr/share/zoneinfo/Universal
BASH

This file contains all the information about the timezone specific time changes (daylight saving time, leaps seconds, ...). It's used by some system software like date.

Timezone

The /etc/timezone file contains the name of the time zone:

cat /etc/timezone 
BASH
Universal
BASH

This file is used by some software to know the system timezone (software using glibc).