wiki:debian-locale-and-timezone
Table of Contents
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 languageLC_TIME— date/time formatLC_NUMERIC— number format (. vs ,)LC_MONETARY— currency symbolsLC_COLLATE— sorting orderLC_CTYPE— character classificationLC_MESSAGES— error messagesLC_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-8en_GB.UTF-8— British Englishde_DE.UTF-8— Germanfr_FR.UTF-8— Frenchja_JP.UTF-8— JapaneseC.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-8oren_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
