Quick checks and fixes to ensure the system uses the correct language and character encoding. 16.11.2025 | reading time: 2 min Locales bind language, character encoding and formatting rules to processes; a wrong locale produces garbled characters, wrong sorting and broken filenames, so checking them is a first troubleshooting step. Practical check Reproduce the problem, then run `echo $LANG` and `locale` to inspect active variables; a typical result looks like `LANG=en_US.UTF-8; LC_CTYPE="en_US.UTF-8"; LC_ALL=""`; list available locales with `locale -a` (example output: `C; POSIX; en_US.utf8`) and inspect system files with `cat /etc/locale.conf` or `cat /etc/default/locale`; to set the system locale use `sudo localectl set-locale LANG=en_US.UTF-8` on systemd systems or `sudo update-locale LANG=en_US.UTF-8` and then `sudo locale-gen en_US.UTF-8` on Debian/Ubuntu, and restart the session to apply changes. Important nuances Remember precedence: `LC_ALL` overrides all `LC_*` variables which override `LANG`; `export LANG=en_US.UTF-8` fixes only the current shell, while `localectl` and `/etc/locale.conf` change the system-wide setting; also note differences between systemd and classic init systems when choosing where to write persistent settings. Repair steps that work If a desired locale is missing, generate it with `sudo locale-gen en_US.UTF-8` or enable it in `/etc/locale.gen` and run the generator; on Debian run `sudo dpkg-reconfigure locales` to pick and build locales interactively, and if programs still misbehave check for a damaged `/usr/lib/locale/locale-archive` or missing language packs and reinstall the `locales` package as needed. Wider use cases Locales affect much more than text display: they influence `sort`, `date` output, numeric formats and collation in databases, so validate settings on servers that handle filenames, CSV exports or user-facing text to avoid subtle bugs across environments. Final thought A quick locale check often saves hours of debugging; start by inspecting `locale` and `locale -a`, generate the missing locales and persist the correct value system-wide, then move on to deeper troubleshooting if needed; if you want to deepen Linux skills consider focused exam preparation such as CompTIA Linux+ or LPIC-1 with intensive courses at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. setup utilities troubleshooting scripting