Site Tools


wiki:debian-locale-and-timezone

Debian Locale and Timezone

Configure language, character encoding, and time settings for your system.

Timezone

Show current timezone:

timedatectl

List available timezones:

timedatectl list-timezones
timedatectl list-timezones | grep America

Set timezone:

sudo timedatectl set-timezone America/New_York
sudo timedatectl set-timezone Europe/London
sudo timedatectl set-timezone UTC

Or manually:

sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Check timezone file:

cat /etc/timezone

System Time

Enable network time sync (NTP):

sudo timedatectl set-ntp true

Show sync status:

timedatectl

Manually set time:

sudo timedatectl set-time "2024-01-15 14:30:00"

Locale

Show current locale:

locale

List available locales:

locale -a

Set system locale:

sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_TIME=en_GB.UTF-8

Reconfigure locales:

sudo dpkg-reconfigure locales

Then select locales to generate. Changes take effect after logout/login.

Keyboard Layout

Show current:

setxkbmap -query

Set temporarily:

sudo loadkeys us

Persistent configuration:

sudo dpkg-reconfigure keyboard-configuration

Then restart:

sudo systemctl restart keyboard-setup

Locale Categories

  • LANG — default language
  • LC_TIME — date/time format
  • LC_NUMERIC — number format (. vs ,)
  • LC_MONETARY — currency symbols
  • LC_COLLATE — sorting order
  • LC_CTYPE — character classification
  • LC_MESSAGES — error messages
  • LC_PAPER — paper size (A4, Letter)

Each can be set independently:

export LC_TIME=de_DE.UTF-8
date           # shows German date format

Common Locales

  • en_US.UTF-8 — US English, UTF-8
  • en_GB.UTF-8 — British English
  • de_DE.UTF-8 — German
  • fr_FR.UTF-8 — French
  • ja_JP.UTF-8 — Japanese
  • C.UTF-8 — POSIX locale (useful for scripts)

Most modern systems use UTF-8; avoid older encodings (ISO-8859-1, etc.).

Tips

  • Servers usually use C.UTF-8 or en_US.UTF-8
  • Locale affects sorting in ls, collation in databases
  • Always set locale before user environment to avoid surprises
wiki/debian-locale-and-timezone.md · Last modified: by 127.0.0.1