Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ls -lt listing files older than 6 months first (Month Day Year) instead of newest files first (Month Day Time)

80 views
Skip to first unread message

paulse...@gmail.com

unread,
Nov 4, 2015, 7:57:42 AM11/4/15
to
Hi all,

I have two separate Solaris 10 servers which are listing files oddly when sorting by time (ls -lt), showing me files that are older than 6 months first.

Example:

total 733
-r--r--r-- 1 root bin 3310 Mar 19 2015 pam.conf-winbind
-rw-r--r-- 1 root sys 450 Mar 3 2015 user_attr
-rwxr-xr-x 1 root sys 4479 Dec 15 2014 wgetrc
prw------- 1 root root 0 Nov 4 08:56 utmppipe
-rw-r--r-- 1 root root 497 Oct 26 02:01 rtc_config
-r--r--r-- 5 root root 4124 Oct 8 02:01 mnttab
drwxr-xr-x 2 root sys 512 Oct 7 11:01 devices
-rw-r--r-- 1 root sys 710 Sep 17 08:02 passwd
drwxr-xr-x 3 root sys 1024 Sep 10 15:08 svc
prw------- 1 root root 0 Sep 10 15:07 initpipe
drwxr-xr-x 2 root sys 512 Sep 10 15:07 lvm


On all other servers I get the correct output:

-r-xr-xr-x 1 root other 662 Jun 5 21:50 TIMEZONE.temp
drwxr-xr-x 4 root sys 1024 Jun 5 21:35 inet
drwxr-xr-x 2 root bin 512 Jun 5 21:05 quagga
-rwxr-xr-x 1 root other 4479 Jun 5 21:04 wgetrc.new
-rw-r--r-- 1 root other 67 Jun 5 21:04 mailcap
drwxr-xr-x 2 root bin 512 Jun 5 21:03 apache2
drwxr-xr-x 3 root bin 512 Jun 5 21:00 samba
-r--r--r-- 1 root bin 3310 Mar 19 2015 pam.conf-winbind
-rwxr-xr-x 1 root sys 4204 Dec 15 2014 wgetrc
-rw-r--r-- 1 root root 28 Nov 21 2014 hosts.equiv
drwxr-xr-x 2 root sys 512 Apr 5 2014 ssh
drwxr-xr-x 2 root sys 512 Apr 5 2014 rcS.d
drwxr-xr-x 2 root sys 512 Apr 5 2014 rc3.d
drwxr-xr-x 7 root bin 512 Apr 5 2014 apache
-rw-r--r-- 1 root sys 578 Apr 5 2014 vfstab
-rw-r--r-- 1 root root 66 Nov 26 2013 resolv.conf
-rw-r--r-- 1 root root 17 Jul 17 2013 hostname.igb0
drwxr-xr-x 2 root sys 512 Jul 17 2013 opscenter


I have checked all locale values and they appear to be correct:

LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=


Anyone know what might be causing this?

Many thanks in advance

Casper H.S. Dik

unread,
Nov 4, 2015, 8:28:27 AM11/4/15
to
paulse...@gmail.com writes:

>Hi all,

>I have two separate Solaris 10 servers which are listing files oddly when sorting by time (ls -lt), showing me files that are older than 6 months first.

>Example:

>total 733
>-r--r--r-- 1 root bin 3310 Mar 19 2015 pam.conf-winbind
>-rw-r--r-- 1 root sys 450 Mar 3 2015 user_attr
>-rwxr-xr-x 1 root sys 4479 Dec 15 2014 wgetrc
>prw------- 1 root root 0 Nov 4 08:56 utmppipe
>-rw-r--r-- 1 root root 497 Oct 26 02:01 rtc_config
>-r--r--r-- 5 root root 4124 Oct 8 02:01 mnttab
>drwxr-xr-x 2 root sys 512 Oct 7 11:01 devices
>-rw-r--r-- 1 root sys 710 Sep 17 08:02 passwd
>drwxr-xr-x 3 root sys 1024 Sep 10 15:08 svc
>prw------- 1 root root 0 Sep 10 15:07 initpipe
>drwxr-xr-x 2 root sys 512 Sep 10 15:07 lvm

Perhaps you could check:
- which ls is used (type ls/which ls/whence ls)
- perhaps an alias is used?

And perhaps you should verify your ls binary....

Casper

Paul

unread,
Nov 4, 2015, 9:38:23 AM11/4/15
to
Thanks for your response Casper

ls is not aliased.

# type ls
ls is a tracked alias for /usr/bin/ls
# which ls
/usr/bin/ls
# whence ls
/usr/bin/ls
# file /usr/bin/ls
/usr/bin/ls: ELF 32-bit LSB executable 80386 Version 1, dynamically linked, stripped


This is a strange one for sure...

Casper H.S. Dik

unread,
Nov 4, 2015, 9:44:57 AM11/4/15
to
Paul <paulse...@gmail.com> writes:

># type ls
>ls is a tracked alias for /usr/bin/ls
># which ls
>/usr/bin/ls
># whence ls
>/usr/bin/ls
># file /usr/bin/ls
>/usr/bin/ls: ELF 32-bit LSB executable 80386 Version 1, dynamically linked, stripped


>This is a strange one for sure...


I actually meant, does it match the package detabase and does it match
elfsign verification:

$ elfsign verify -v /bin/ls
elfsign: verification of /bin/ls passed.
format: rsa_md5_sha1.
signer: CN=SunOS 5.10, OU=Solaris Signed Execution, O=Sun Microsystems Inc.

And what does /usr/bin/amd64/ls report?

(Assuming this is a 64 bit AMD/Intel system)

Casper

Geoff Clare

unread,
Nov 4, 2015, 10:11:10 AM11/4/15
to
paulsearle77 wrote:

> Hi all,
>
> I have two separate Solaris 10 servers which are listing files oddly
> when sorting by time (ls -lt), showing me files that are older than
> 6 months first.
>
> Example:
>
> total 733
> -r--r--r-- 1 root bin 3310 Mar 19 2015 pam.conf-winbind
> -rw-r--r-- 1 root sys 450 Mar 3 2015 user_attr
> -rwxr-xr-x 1 root sys 4479 Dec 15 2014 wgetrc
> prw------- 1 root root 0 Nov 4 08:56 utmppipe
> -rw-r--r-- 1 root root 497 Oct 26 02:01 rtc_config

What is the output of "date"? I suspect it is 2014 instead of 2015.
Files with future dates are listed the same way as files older
than 6 months.

--
Geoff Clare <net...@gclare.org.uk>

Paul

unread,
Nov 5, 2015, 2:33:04 AM11/5/15
to
Thank you Geoff. You hit the nail on the head.
(Wow I feel embarrassed for not spotting that!)

Thank you all for your help with this.

Cydrome Leader

unread,
Nov 5, 2015, 4:02:00 PM11/5/15
to
Interesting one there. Is this standard-ish across the unix world?

Geoff Clare

unread,
Nov 6, 2015, 8:41:09 AM11/6/15
to
Cydrome Leader wrote:

> Geoff Clare <ge...@clare.see-my-signature.invalid> wrote:
>>
>> Files with future dates are listed the same way as files older
>> than 6 months.
>
> Interesting one there. Is this standard-ish across the unix world?

It's required by POSIX if the current locale is "C" or "POSIX".
Most implementations seem to follow the same convention for other
locales as well.

--
Geoff Clare <net...@gclare.org.uk>
0 new messages