Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
This is strange.
on my system I see that /etc/locales.conf gives the following for the default and en_US locales.
Code:
[default]
date format = %b %e %Y %I:%M:%S:%z%p
[en_US]
date format = %b %e %Y %I:%M:%S:%z%p
language = us_english
charset = iso_1
Both those are identical, and my locale is en_US but the date command gives
"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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.