3

if I do an ls -l, I get output such as the following:

-rwxr-xr-x 1 root root        93584 Apr 21  2017  zipsplit
-rwxr-xr-x 1 root root        26624 Ott  5  2018  zjsdecode
-rwxr-xr-x 1 root root         2206 Aww 23 11:24  zless
-rwxr-xr-x 1 root root         1842 Aww 23 11:24  zmore
-rwxr-xr-x 1 root root         4553 Aww 23 11:24  znew

See where the date is... how do I change that to English?

I'm using Konsole on Kubuntu.

Edit: Output of locale as requested:

daniel@cassiopeia:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=mt_MT.UTF-8
LC_TIME=mt_MT.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=mt_MT.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=mt_MT.UTF-8
LC_NAME=mt_MT.UTF-8
LC_ADDRESS=mt_MT.UTF-8
LC_TELEPHONE=mt_MT.UTF-8
LC_MEASUREMENT=mt_MT.UTF-8
LC_IDENTIFICATION=mt_MT.UTF-8
LC_ALL=

There is clearly a mixture of US-English and Maltese in there. How do I get rid of the Maltese and just keep English? Or, say, change it to UK English?

5
  • 1
    Possible duplicate of How do I change the language via a terminal?
    – Rinzwind
    Nov 7, 2019 at 19:46
  • 1
    ^ that doesn't show how to change the language for dates, which is set by LC_TIME
    – Zanna
    Nov 8, 2019 at 18:25
  • Do you only want dates to be displayed in English, or are there other elements you want to be in English? Do you always want dates displayed in English, or just temporarily? Can you edit and give the output of locale?
    – Zanna
    Nov 9, 2019 at 5:38
  • 1
    @Zanna I just want everything to be in English. I've added the output of locale as requested.
    – Gigi
    Nov 9, 2019 at 8:48
  • Thanks! I think you'll be able to do this through Language Support settings. Sorry that I don't know what it looks like in Kubuntu... I also don't know how to do it properly by command line. Hopefully you will get an answer soon.
    – Zanna
    Nov 9, 2019 at 9:52

2 Answers 2

4

I'm assuming, from another question by you, that you're using Kubuntu 19.10. (This is somewhat important because some settings move around from one version to another.)

In Kubuntu 19.10 with the kubuntu-backports ppa installed, I'm on

Operating System: Kubuntu 19.10
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

In this system, open System Settings > Regional Settings, and click on the Formats icon in the left panel. In the image below, I chose a time format setting for Malta from the dropdown next to Time, logged out and logged in again. On opening konsole, I see this

Time format setting for Malta

To change to something else, I just go through the process again, log out and log back in:

Time format setting for UK


One point to note is that just because you see something in the dropdown (in System Settings > Regional Settings) and can apparently choose it, that doesn't mean it's actually available.

To get mt_MT.utf8 on my system, I had to "uncomment" the relevant entry in /etc/locale.gen and then run sudo locale-gen.

2
  • System Settings -> Regional Settings did it. I didn't have to install anything or touch any files.
    – Gigi
    Nov 9, 2019 at 16:07
  • 1
    @Gigi I had to in order to get mt_MT.utf8 on my system so I thought I'd mention it.
    – DK Bose
    Nov 9, 2019 at 16:10
1

As rinzwind commented, you can change locale for the Whole terminal use.
As I guess, you just want to change the language for one command, sometimes only.

In that case, simply 'prefix' the command with a variable. It is command expansion.
See the bash manual : https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Simple-Command-Expansion

$ LANG=en_US.utf8 ls -l
-rwxr-xr-x 1 root root        93584 Apr 21  2017  zipsplit
-rwxr-xr-x 1 root root        26624 Oct  5  2018  zjsdecode
(...)

$ LANG=en_US.utf8 gnome-control-center
# will start the gui with english language

$ GZIP=-9 tar cvzf /path/to/archive myarchive.tar.gz
# This will set max compression level (9) for gzip option in tar command


You can also create some aliases in your .bashrc in order to change locale language quickly :

# inside .bashrc
alias langen='LANG=en_US.utf8'
alias langne='LANG=ne_NP UTF-8'

# Then in a terminal
$ langen
$ ls -l
# get an output in  english
# then switch back to your preferred language
$ langne


Get enabled locales (installed locale languages) codes with locale -a.
Get avaiable locales with cat /etc/locale.gen
Enable a new one with sudo locale-gen ne_NP UTF-8

4
  • 1
    There is no indication that they want to change the language for one command. What they have said is that they want to change the language in which dates are displayed (in the terminal), for example when running ls. This is done in Language Support under Regional Formats IIRC
    – Zanna
    Nov 8, 2019 at 18:07
  • or by editing the locale settings, but not the ones the suggested duplicate mentions (here's a screenshot from my Konsole on Xubuntu - I'm using Konsole because it renders Tamil correctly, unlike other terminal emulators - I'm not using Kubuntu so I don't know how to answer this question properly)
    – Zanna
    Nov 8, 2019 at 18:18
  • @Zanna : Language Support under Regional Formats has more than 'Terminal' as focus. That's why i suggested the command expansion. I guess you will understand that i well understood the question. Kind of I had myself in the past.
    – cmak.fr
    Nov 8, 2019 at 20:12
  • @Zanna is right. I don't want to change it just for one command (why would I do that?).
    – Gigi
    Nov 9, 2019 at 8:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .