Language plays a very important role everywhere and if you are not using language you understand, it’s just useless for you to use any system. Similarly, in Linux/Unix servers, we have the option to choose our own locale, though English is an international language, but sometimes there is a need to change the language as per your project need and thus this article focus on showing how you can easily change the language through command line in Red Hat Enterprise Linux 7 (RHEL 7) or CentOS 7.
In my experience, I have seen that many of the system owners want language to be changed. This may be due to application requirement or they want to use their native language.
Language can be changed whole system wide or even for a particular user. You will be surprised to know that the locale can also be set for ssh session also. In this tutorial we will focus on changing the language system wide only.
System Wide Language Change in RHEL 7 / CentOS 7
1. First, check what is the current language of your system by below command.
[root@client10 ~]# cat /etc/locale.conf LANG="en_IN.UTF-8" [root@client10 ~]#
[root@client10 ~]# locale |grep -i lang LANG=en_IN.UTF-8
2. Now, change the language to desired one. In this example, I’m taking “en_US.iso88591“.
[root@client10 ~]# vi /etc/locale.conf LANG="en_US.iso88591" :wq [root@client10 ~]# cat /etc/locale.conf LANG="en_US.iso88591" [root@client10 ~]#
Alternatively, language can also be changed by using “localectl” command as below.
[root@client10 ~]# localectl set-locale LANG=en_US.iso88591 [root@client10 ~]# cat /etc/locale.conf LANG=en_US.iso88591 [root@client10 ~]#
Now, just logout and login and you will see new locale is effective. For locale change NO REBOOT is required.
TIP: To check what locale are available on your system you can use “localectl” command with “list-locales” option. The list will be long so better sort it out using grep.
[root@client10 ~]# localectl list-locales |grep en_ en_AG en_AG.utf8 en_AU en_AU.iso88591 en_AU.utf8 en_BW en_BW.iso88591 en_BW.utf8 -------------- O/P Truncated --------------
Hope, you enjoyed learning how to change locale using command line mode in RHEL 7 and CentOS 7. If you have a question or concern, please let me know through your comments below. If you like the article, do not forget to share it.
Incoming search terms:
- centos set language in command line