Page 1 of 1
ls -l date format ?
Posted: Tue Aug 20, 2013 9:26 am
by mark1mint
I've seen that by default
ls -l in Mint 13 lists the date field in this format
which I find very convenient when using sort,therefore I'd like to replicate this setting in some other distros that I also use,only I haven't managed to understand where to look:in
/etc/bash.bashrc I can't see anything regarding time or format,neither anything apparently related using printenv.
This has to be somewhere,or it is just the default behavior of ls in Ubuntu12/Mint13 ?
Re: ls -l date format ?
Posted: Tue Aug 20, 2013 11:09 am
by xenopeek
From the manpage of ls:
Code: Select all
--time-style=STYLE
with -l, show times using style STYLE: full-iso, long-iso, iso,
locale, +FORMAT. FORMAT is interpreted like `date'; if FORMAT
is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files
and FORMAT2 to recent files; if STYLE is prefixed with `posix-',
STYLE takes effect only outside the POSIX locale
Doing a `ls -l --time-style=locale` gives me the default format, the one you desire (but it gives me that also without the --time-style=locale). The clue here being that the time style is taken from your locale. So if you have a different locale on another distro, it may display this differently. With the --time-style=+FORMAT, with FORMAT replaced by a format string as described in the date manpage, you can fully configure the time format. But I guess you have different locales. You can check your locale with the command `locale`.
Aside from /etc/bash.bashrc, also /etc/profile, /etc/profile.d and ~/.profile don't have any aliases for ls. Perhaps you added some? You can dump all your aliases with the command `alias`. Perhaps check that also on your other distro.
Re: ls -l date format ?
Posted: Wed Aug 21, 2013 8:14 am
by mark1mint
Thank you very much,it could actually be a matter of different locale:I've now checked on Ubuntu 10.04,and there is this difference
Code: Select all
ubuntu mint
LANG=en_US.UTF-8 LANG=en_US.UTF-8
LANGUAGE=en_US:en LANGUAGE=
maybe this is the reason why ls-l has a different time format ?
As for the aliases,I haven't any custom ones in Mint 13 neither Ubuntu,the latter has some more default aliases but none are related to ls - l time format.
Assuming that the slight difference above could be responsible for the different format,I wouldn't change the locale,I'd rather set a custom alias for the specific time format that I'm after:should I put it in
/etc/bash.bashrc ?
Re: ls -l date format ?
Posted: Wed Aug 21, 2013 8:42 am
by xenopeek
I'm not sure that will make much a difference. Isn't the issue here that you are using a very old Ubuntu release, and probably just using a much different version of ls? Check version with:
From tests I have done the LANGUAGE set or unset doesn't make a difference. You can set the LANGUAGE temporarily with:
or unset it temporarily:
Then run the locale command to confirm the change, and try your ls -l to see if it makes a difference. I doubt it. Close your terminal and open a new terminal, and the settings will be reset to their original values.
To change the setting of LANGUAGE permanently, I don't know for sure how to do that on such an old Ubuntu release. These days you would set it in /etc/default/locale.
Re: ls -l date format ?
Posted: Thu Aug 22, 2013 8:50 am
by mark1mint
Yes,as you pointed out the ls version included in Ubuntu 10.04 is way older than the one in Mint 13 (kinda unsurprisingly,given that this is based on Ubuntu 12.04)-and also,as you suggested,the
LANGUAGE=en_US:en variable doesn't do any difference,either when using export and then doing ls -l or using
If I really want to use that time format for ls -l,looks like I'll just have to set an alias,probably in .profile or .bashrc I guess.
Thanks for your help,BTW.
Re: ls -l date format ?
Posted: Thu Aug 22, 2013 9:44 am
by xenopeek
No problem. You can either set an alias in /etc/bash.bashrc to have it apply to all users, or indeed in your home folder in .bashrc to only apply it to you.