{"id":10900,"date":"2021-10-05T08:44:06","date_gmt":"2021-10-05T08:44:06","guid":{"rendered":"https:\/\/linuxways.net\/?p=10900"},"modified":"2021-10-05T08:44:06","modified_gmt":"2021-10-05T08:44:06","slug":"system-locales-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/system-locales-in-linux\/","title":{"rendered":"System Locales in Linux"},"content":{"rendered":"<p>As different users have different preferences for the operating system so they must want to customize it as per their preferences. Some might want different time zones in different languages and different countries with a different currency that they prefer on their Linux interface.<\/p>\n<p>In this case, the locale is used as it can be used to change or set language, countries, time\/date format, currencies, and many more as per the user preferences. So we are going to discuss such locales and discuss the process of changing or setting such locales on Linux.<\/p>\n<h3>To view the current system locale in Linux<\/h3>\n<p>We can look over the current system locale using the following command. With the command, we will get different variables that can be reset with different values as per user preference.<\/p>\n<pre>$ locale<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"539\" height=\"336\" class=\"wp-image-10901\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-114.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-114.png 539w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-114-300x187.png 300w\" sizes=\"auto, (max-width: 539px) 100vw, 539px\" \/><\/p>\n<p>Also, using localectl status command, it will result the same.<\/p>\n<pre>$ localectl status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"572\" height=\"91\" class=\"wp-image-10902\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-115.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-115.png 572w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-115-300x48.png 300w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/><\/p>\n<h3>To display all available locales in Linux<\/h3>\n<p>You can check all available locales on your Linux system with the following command:<\/p>\n<pre>$ locale -a<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"538\" height=\"135\" class=\"wp-image-10903\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-116.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-116.png 538w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-116-300x75.png 300w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/p>\n<h3>To display details of specific variables in Linux<\/h3>\n<p>We can check the details of specific variables using the variable name. In case you want to check details on LC_TIME that stores the time and date format, LC_ADDRESS that stores streets or postal addresses format, LC_TELEPHONE that stores format of telephone settings, and so on.<\/p>\n<p>To get such details, we can run the following commands:<\/p>\n<pre>$ locale -k LC_ADDRESS<\/pre>\n<pre>$ locale -k LC_TIME<\/pre>\n<pre>$ locale -k LC_TELEPHONE<\/pre>\n<pre>$ locale -k LC_TIME<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"570\" class=\"wp-image-10904\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-117.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-117.png 869w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-117-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-117-768x504.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/p>\n<pre>$ locale -k LC_ADDRESS<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"296\" class=\"wp-image-10905\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-118.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-118.png 756w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-118-300x117.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/p>\n<h3>To change or set system locale in Linux<\/h3>\n<p>We can change or set system locale in Linux by using the update-locale program. Using the LANG variable, it will allow us to set up the locale for the entire system.<\/p>\n<p>We can set the LANG to en_IN.UTF-8 LANGUAGE and remove the definition for language by using the following command.<\/p>\n<pre>$ sudo update-locale LANG=LANG=en_IN.UTF-8 LANGUAGE<\/pre>\n<p>Or,<\/p>\n<pre>$ sudo localectl set -locale LANG=en_IN.UTF-8<\/pre>\n<h3>To view Global locale setting<\/h3>\n<p>We can check or view the global locale setting in the following file on Linux:<\/p>\n<pre>$ sudo vim \/etc\/default\/locale<\/pre>\n<h3>To change the locale<\/h3>\n<p>We can modify the .bashrc profile after already setting the value of locale. Go through the following command:<\/p>\n<pre>$ sudo vim ~\/.bashrc<\/pre>\n<h3>To change the locale for single user<\/h3>\n<p>To set the global locale for the single user, we can add the following line at the end of ~\/.bashrc_profile<\/p>\n<pre>$ sudo vim ~\/.bashrc_profile<\/pre>\n<pre>LANG=\u201den_IN.UTF-8\u201d<\/pre>\n<pre>export LANG<\/pre>\n<p>To get more details on locale, update-locale, and localectl, we can check the manual section as below:<\/p>\n<pre>$ man locale<\/pre>\n<pre>$ man update-locale<\/pre>\n<pre>$ man localectl<\/pre>\n<h2>Conclusion:<\/h2>\n<p>In this article, you learnt how to set a system and view the locale on Linux. Thank you for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>As different users have different preferences for the operating system so they must want to customize it as per their preferences. Some might want different time zones in&hellip;<\/p>","protected":false},"author":1,"featured_media":10946,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[35,603],"class_list":["post-10900","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-linux","tag-system-locales"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10900"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10900\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10946"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}