# Debian locale and timezone Configure language, character encoding, and time settings for your system. ## Timezone Show current timezone: ```bash timedatectl ``` List available timezones: ```bash timedatectl list-timezones timedatectl list-timezones | grep America ``` Set timezone: ```bash sudo timedatectl set-timezone America/New_York sudo timedatectl set-timezone Europe/London sudo timedatectl set-timezone UTC ``` Or manually: ```bash sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime ``` Check timezone file: ```bash cat /etc/timezone ``` ## System time Enable network time sync (NTP): ```bash sudo timedatectl set-ntp true ``` Show sync status: ```bash timedatectl ``` Manually set time: ```bash sudo timedatectl set-time "2024-01-15 14:30:00" ``` ## Locale Show current locale: ```bash locale ``` List available locales: ```bash locale -a ``` Set system locale: ```bash sudo update-locale LANG=en_US.UTF-8 sudo update-locale LC_TIME=en_GB.UTF-8 ``` Reconfigure locales: ```bash sudo dpkg-reconfigure locales ``` Then select locales to generate. Changes take effect after logout/login. ## Keyboard layout Show current: ```bash setxkbmap -query ``` Set temporarily: ```bash sudo loadkeys us ``` Persistent configuration: ```bash sudo dpkg-reconfigure keyboard-configuration ``` Then restart: ```bash 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: ```bash 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