Locale, Date & Time
Locale
In Linux, a locale is a set of environment variables that defines the language, country, and character encoding settings for a user's environment. Locales affect various aspects of a program's behavior, such as the way dates and times are displayed, the format of numbers, the sort order of strings, and the language used for messages.
------------------------------------------------------------------------------------------------------------------------------------------------
View current locale configuration
localectl
and
locale
View specific locale variable setting (You can view the different options using the locale command above^option
locale LC_NUMERIC
View available locales
localectl list-locales
------------------------------------------------------------------------------------------------------------------------------------------------
Setting locale
localectl set-locale LANG=fr_FR.utf8
(reboot may be required)
------------------------------------------------------------------------------------------------------------------------------------------------
Time
------------------------------------------------------------------------------------------------------------------------------------------------
Check system time
date
or for more detail
timedatectl
------------------------------------------------------------------------------------------------------------------------------------------------
NTP
View current NTP configuration:
timedatectl show-timesync --all
Enable NTP
timedatectl set-ntp on
Disable NTP
timedatectl set-ntp off
NTP Server selection
Most mainstream Linux distributions come with NTP servers preconfigured, these can be altered however, this is done via the /etc/systemd/timesync.conf file. Simply add a new line to the file formatted as follows:
NTP=NTPSERVERHOSTNAME
------------------------------------------------------------------------------------------------------------------------------------------------
Timezone
Check available timezones
timedatectl list-timezones
Set server timezone
timedatectl set-timezone timezonename
------------------------------------------------------------------------------------------------------------------------------------------------