
I needed to post-configure a dedicated server, it was pre-installed by hosting prodiver and therefore didn't have some of the settings. Great opportunity to revisit locale management in modern Linux.
What is a locale?
In computer software, locale is a group of regional settings defining how messages will be shown, what languange they will use and also how date and time, numbers and currency are going to be represented.
Modern operating systems have quite a number of parameters available to be configured, just use locale command to review them:
greys@srv:~ $ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
Why I change locale
With the default locale being en_US most of the time, any Unix box I'm working on is already showing messages in the language of my preference: English. So I usually update locale for two primary reasons:
- date format — here in Ireland we specify November 27th 2019 as 27/11/2019, for example
- currency — I adopted using the euro sign € quite a while ago and find that reading figures like €50 is easier than eur50 or EUR50 for me
Before You Change locale
Use the locale -a command to confirm if your system supports the locale you need:
root@srv:~ # locale -a C C.UTF-8 POSIX en_US.utf8
This shows that Irish locales are not configured yet, so before I can change anything I'll need to set it up.
Configure Locale of Your Choice
In Debian (and Ubuntu), I need to run this:
root@srv:~ # dpkg-reconfigure locales
Once started, this command will give you a text dialogue window, you need to scroll through the list of locales and mark the ones you need:

Once done (and Ok button in the dialogue is pressed or clicked), you'll see the summary of generated locales:
root@srv:~ # dpkg-reconfigure locales
Generating locales (this might take a while)…
en_IE.UTF-8… done
en_US.UTF-8… done
Generation complete.
Excellent! Now we can proceed.
Set New Default Locale
As is the case with so many core services managed by SystemD, global locale settings should be managed by a control command: localecmd.
Here's how I can use localecmd to select Irish locale:
root@srv:~ # localectl set-locale en_IE.UTF-8
If you want to confirm that this locale will be used after reboot, in Debian you should check the /etc/default/locale file:
root@srv:~ # cat /etc/default/locale LANG=en_IE.UTF-8
That's it for today! Have fun!
See Also
- localectl command
- locale command
- dpkg-reconfigure command
- Unix Commands
- Linux commands
- Manage timezones with timedatectl
- Debian 10