change system-wide date format
The 'date' command on my system is formatted to show the results as: Fri 16 Apr 20 21 10:26:01 AM EDT.
Since the date command is so versatile I wonder if it is possible to change the way dates and times show up in various commands such as 'ls' and the like. I assume it would be to change the LC_TIME parameter system wide, but I cannot find where it is originally set. Any help is very much appreciated |
I don't know the answer either, but as opposed to any assumption surrounding LC_TIME, perhaps instead give the source for 'ls' or another command concerned a quick look and determine how it processes the date/time for the output it generates. Because if it is a property, then great.
|
"man date" gives lots of formatting information, and if you want the display to be formatted different than the default it should be easy to design a format that satisfies you then make it an alias for your user so it always displays the way you wish. The alias could be put into ~/.bashrc if you are using bash.
My default display, using fedora is "Fri Apr 16 10:01:51 AM CDT 2021" Using an alias means you would not have to mess with the default config. |
1) /etc/default/locale. Changed by update-locale.
2) /etc/locale.conf. Changed by localectl. 3) localehelper from the eponymous package. Used like this: Code:
localehelper LANG=C -- ls -l Code:
LC_ALL=C ls -l |
Thanks, Shruggy. That oughta do it.
|
This is strange.
on my system I see that /etc/locales.conf gives the following for the default and en_US locales. Code:
[default] "Fri Apr 16 10:01:51 AM CDT 2021" So the config for the date displayed does not match the formatting given in that config file. |
@computersavvy. locales.conf is different from locale.conf. I meant the latter.
|
On my system I have both, and the locale.conf only lists the language for the locale (LANG="en_US.UTF-8")
Obviously a difference in the way different distros are configured. |
All times are GMT -5. The time now is 05:28 PM. |