LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-31-2017, 07:20 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Rep: Reputation: 51
how did the ls command display dates in old Linux versions?


Hi: how did the ls command display dates in old Linux versions? Did it use the month name? If you ask how old, take Linux 2.x.x. That's all.
 
Old 05-31-2017, 07:45 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,164

Rep: Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371Reputation: 1371
Quote:
Originally Posted by stf92 View Post
Hi: how did the ls command display dates in old Linux versions?
Obligatory, it's GNU/Linux, not Linux

But seriously, there is no reason for the kernel version to affect the format of date printed by ls. Perhaps you should check the coreutils NEWS file: http://git.savannah.gnu.org/cgit/cor....git/tree/NEWS, e.g.

Quote:
* Noteworthy changes in release 8.6 (2010-10-15) [stable]
[...]
ls -l now uses the traditional three field time style rather than
the wider two field numeric ISO style, in locales where a style has
not been specified. The new approach has nicer behavior in some
locales, including English, which was judged to outweigh the disadvantage
of generating less-predictable and often worse output in poorly-configured
locales where there is an onus to specify appropriate non-default styles.
[The old behavior was introduced in coreutils-6.0 and had been removed
for English only using a different method since coreutils-8.1]
 
Old 05-31-2017, 07:51 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,883

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
I don't recall that it was different. Might have to look at old books or find an old man page?

Pretty sure you could find a floppy image or some old distro and run it in a vm to see. Thoms boot disk would have a minimal busybox but busybox versions may not act like stand alone programs.
 
Old 05-31-2017, 09:17 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
Exclamation

Quote:
Originally Posted by ntubski View Post
Obligatory, it's GNU/Linux, not Linux

But seriously, there is no reason for the kernel version to affect the format of date printed by ls.
You are right. It can only depend on ls itself, assuming one uses always the same ls options. I'll try to make both date and ls -l to display date/times in the format DD-MM-YY HH:MM. By the way, cant you tell me what does "FORMAT is interpreted like 'date'" mean in ls man page? I quote:
Code:
       --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
EDIT: I think I now understand: +FORMAT is interpreted by this option in the same way as it is interpreted in the date command syntax.

Last edited by stf92; 05-31-2017 at 09:28 PM.
 
Old 06-03-2017, 08:40 AM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 253

Rep: Reputation: 125Reputation: 125
Since kernel 1.2.1 the same way as it does now, but I do not know if there was a way to change the format displayed
 
Old 06-03-2017, 09:20 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,505
Blog Entries: 16

Rep: Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211Reputation: 3211
I didn't know this before, but you can change the style of the date display by adding arguments to the ls command.

Code:
$ ls -l --time-style=long-iso
total 22036
-rw-r--r--  1 [username] users    25525 2015-08-10 10:09 akregator2015-08-10.xml
-rw-r--r--  1 [username] users    52114 2015-11-17 11:11 alberteinstein.jpg
-rw-r--r--  1 [username] users   412990 2015-11-17 11:10 alberteinstein.png
-rw-r--r--  1 [username] users    42388 2016-12-02 15:42 bc.txt
(snip)


ls -l --time-style=full-iso
total 22036
-rw-r--r--  1 [username] users    25525 2015-08-10 10:09:12.190836315 -0400 akregator2015-08-10.xml
-rw-r--r--  1 [username] users    52114 2015-11-17 11:11:25.545064156 -0500 alberteinstein.jpg
-rw-r--r--  1 [username] users   412990 2015-11-17 11:10:45.683063779 -0500 alberteinstein.png
-rw-r--r--  1 [username] users    42388 2016-12-02 15:42:52.641382333 -0500 bc.txt
(snip)
From the ls man page:

Quote:
--time-style=STYLE
with -l, show times using style STYLE: full-iso, long-iso, iso, locale, or +FORMAT; FORMAT is interpreted like in 'date'; if FORMAT is FORMAT1<newline>FORMAT2, then 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

Last edited by frankbell; 06-03-2017 at 09:22 PM. Reason: Consistency
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: On dates and stuffed non-dates LXer Syndicated Linux News 0 10-08-2014 02:21 AM
Bash command for comparing two dates Completely Clueless Linux - Software 6 03-25-2013 06:34 PM
Display software versions ?? bkochis Linux - Newbie 3 11-01-2007 01:42 PM
How to write a command to FTP files with dates filenames mistiqshannen Linux - Newbie 5 06-05-2007 12:59 AM
How do I display te BMC and SDR versions ? dazdaz Linux - Hardware 0 03-24-2005 06:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration