Hi Bob, Eric and Paul, Thank you all for your quick responses. Due to time zone differences, I had gone home so I did not see your emails until this morning. I'm based in Galway, Ireland. I'm 5 to 8 hours ahead of you depending where in USA you are. I started putting together a response to your email but then got switched to another task and only got a chance to work on it again today. I realize that you may now be out of office due to Thanks Giving holiday.
I've pulled together all your responses into this one email. I've run most of the commands you supplied and have attached them to this email. Unfortunately, none of your suggestions worked for me. The result I was expecting was 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm See test data in attached files. The --time-style=long.iso seem to alter the way in which the time field is handled in the sort command. From my results, it appears the XX:YY (XX=Hours YY=Minutes) are treated as separate fields without this option. See attached file for this. I have a few questions 1) Should LC_ALL be set to 'C' or C or are they equivalent export LC_ALL='C' I've tried both way and it appeared not to alter the result. Please find attached the commands I ran with the locale unset , set to C and set to 'C'. Eric, you mentioned that RH 6.3 is an old release. Where can I get the latest approved RH release ? RH 6.3 is the latest release that Avaya has approved for internal use but given my reported issue It would be useful to use --debug to see what is happening or not happening. Thanks for all of your assistance, Terence Coffey ======= Paul Eggert [egg...@cs.ucla.edu] Most likely it's a locale problem. Try "sort --debug" and try setting LC_ALL='C' in your environment. ======== tag 12907 notabug thanks On 11/16/2012 11:06 AM, Coffey, Terrence (Terrence) **CTR** wrote: > Hi, > I think I might have located a bug. I'm using Redhat 6.3. Thanks for the report. However, I suspect that you are hitting this FAQ, and not a bug in sort itself: https://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021 Unfortunately, the 'sort' version shippted in RHEL 6.3 is too old to support the --debug option, but upgrading to a newer version will help shed some insight into your problems. > [WFUser@RHEL63TEMP3942 tmp]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 As I don't have the same 'ls -Asl /tmp' output, I took your output and put in in a temp file of my own. Now, on that file, and with the sort 8.15 in Fedora 17, I get: $ LC_ALL=en_US.UTF-8 sort --debug -k11 -k7M -k8n -k9,10 tmpfile sort: using `en_US.UTF-8' sorting rules sort: leading blanks are significant in key 1; consider also specifying `b' sort: key 3 is numeric and spans multiple fields sort: leading blanks are significant in key 4; consider also specifying `b' total 76 ^ no match for key ^ no match for key ^ no match for key ^ no match for key ________ 0 -rw-------. 1 root root 0 Nov 9 15:06 yum.log ^ no match for key ___ _ ______________ _______________________________________________________ 4 -r--r--r--. 1 root root 11 Nov 9 17:37 .X0-lock ^ no match for key ___ _ _______________ ________________________________________________________ ... Wow - just that much information is quite useful. You aren't sorting what you thought you were sorting. > > The filename is key 11 so I was expecting to see all the dot files > group together The filename is NOT field 11, but field 10 (fields start with 1, not 0). Furthermore, the debug option is warning you that unterminated -k specifications are risky; for example, it is better to use -k7,7M than -k7M. Also, it is warning you that -k11 includes leading space, which may affect the sort (depending on your locale). Paul already pointed out that your choice of locale may be important (en_US.UTF-8 typically does a dictionary sort, ignoring punctuation, but '.' is punctuation). > I'm try to get a listing of dot file sorted by date and all other files > sorted by date. I'd like all the dot file to appears before all other files. Here's something closer, but it still has a fatal flaw - the moment you request to sort by dot files first, you have specified that key takes priority over dates. $ LC_ALL=C sort -k10b -k7,7M -k8,8nb -k9,9 tmpfile total 76 4 drwxrwxrwt. 2 root root 4096 Nov 9 18:35 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 9 17:37 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 9 18:35 .X11-unix 4 -r--r--r--. 1 root root 11 Nov 9 18:35 .X2-lock 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 drwx------. 2 root root 4096 Nov 9 18:35 keyring-kjLYun 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 keyring-nQ6lMb 4 drwx------. 2 WFUser WFUser 4096 Nov 9 18:20 orbit-WFUser 4 drwx------. 2 gdm gdm 4096 Nov 9 17:39 orbit-gdm 4 drwx------. 2 root root 4096 Nov 9 18:35 orbit-root 4 drwx------. 2 gdm gdm 4096 Nov 9 17:40 pulse-Jkx9hhtHj4dy 4 drwx------. 2 root root 4096 Nov 9 18:35 pulse-TSaTZvcbd1kc 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 drwx------. 2 root root 4096 Nov 9 18:35 ssh-BRSEI10523 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 virtual-WFUser.AVmQkN 0 -rw-------. 1 root root 0 Nov 9 15:06 yum.log Really, the ONLY way you are going to sort two independent chunks of your list by date is to instead concatenate two independently sorted chunks, and realize that ls already does the date sorting that you desire. Perhaps you are really looking for: (set -f; ls -lsd --sort=date /tmp/.[!.] /tmp/.?*; ls -ls --sort=date /tmp) -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org -----Original Message----- From: Bob Proulx [mailto:b...@proulx.com] Sent: 16 November 2012 18:59 To: Coffey, Terrence (Terrence) **CTR** Cc: 12...@debbugs.gnu.org Subject: Re: bug#12907: Possible Bug in sort core utility tag 12907 + moreinfo thanks Coffey, Terrence (Terrence) **CTR** wrote: > I think I might have located a bug. I'm using Redhat 6.3. What locale are you using? You can print out your locale settings with the locale command. $ locale Very often the locale is set to a "human" locale where case is folded and punctuation is ignored in "dictionary" style. This ordering is a libc system library definition. > I'm try to get a listing of dot file sorted by date and all other > files sorted by date. I'd like all the dot file to appears before all > other files. I personally would do this with two different commands. First list the dot files using shell file glob matching only dot files. Second list non-dot files. I would also use the --time-style=long-iso format so that the dates are printed consistently. $ ls -Ald /tmp/.[!.]* ; ls -Ald /tmp/* But I realize that sets different columns for the two different commands. > Initially I was testing on 6.2 and noticed that the .(dot) files were > not passed to sort. However this issue is fixed in 6.3. I have no idea what you are talking about. I don't recall any bug in that area. And if it is there then bringing up a fixed bug muddies the water. > However it does not appear to be able to sort dot files. The filename > is key 11 In your example the filename is key 10 not 11. 0 -rw-------. 1 root root 0 Nov 9 15:06 yum.log 1 2 3 4 5 6 7 8 9 10 That might be the most of your problem. > If you need some additional data, just let me know. Try this: $ ls -Asl --time-style=long-iso / | env LC_ALL=C sort -k9,9 -k7,8 Then please report back in if your problem is resolved. Please keep the bug log in the recipient list. See also the FAQ entry: http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021 Bob
Current locale [WFUser@RHEL63TEMP3942 ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= Current files in /tmp directory [WFUser@RHEL63TEMP3942 ~]$ ls -asl /tmp total 52 4 drwxrwxrwt. 8 root root 4096 Nov 23 10:56 . 4 dr-xr-xr-x. 26 root root 4096 Nov 19 16:06 .. 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Sort by filename and then by time. Incorrect as all the dot files are not sorted together as one would expect [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k10 -k7M -k8n -k9 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix Test to see if the MM:SS field is treated as one field [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Test to see if Time is treated as two fields. Test for sorting by time ==> Correct (Nolte filename excluded) [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Same sort but with the filename included. Note It's incorrect [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso /tmp | env LC_ALL=C sort -k9,9 -k7,8 total 44 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 2012-11-19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ Incorrect .tc3 is listed before .tc4. Since .tc4 should be listed before .tc3 [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso /tmp | sort -k9,9 -k7,8 total 44 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .esd-500 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .ICE-unix 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:06 orbit-gdm 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 pulse-g9SlRO3UEqGg 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:05 pulse-Jkx9hhtHj4dy 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:15 .tc4 4 -r--r--r--. 1 root root 11 2012-11-19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .X11-unix [WFUser@RHEL63TEMP3942 ~]$ Same command but with out env LC_ALL as part of the command [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Ald /tmp/.[!.]* drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 /tmp/.esd-500 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 /tmp/.ICE-unix -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 /tmp/.tc -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 /tmp/.tc2 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 /tmp/.tc3 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 /tmp/.tc4 -r--r--r--. 1 root root 11 Nov 19 16:05 /tmp/.X0-lock drwxrwxrwt. 2 root root 4096 Nov 19 16:05 /tmp/.X11-unix [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$
[WFUser@RHEL63TEMP3942 ~]$ export LC_ALL=C [WFUser@RHEL63TEMP3942 ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -asl /tmp total 52 4 drwxrwxrwt. 8 root root 4096 Nov 23 10:56 . 4 dr-xr-xr-x. 26 root root 4096 Nov 19 16:06 .. 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k10 -k7M -k8n -k9 total 44 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso . | env LC_ALL=C sort -k9,9 -k7,8 total 192 4 -rw-------. 1 WFUser WFUser 310 2012-11-09 17:39 .ICEauthority 4 drwxrwxr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 .abrt 8 -rw-------. 1 WFUser WFUser 5416 2012-11-23 15:43 .bash_history 4 -rw-r--r--. 1 WFUser WFUser 18 2012-04-23 11:53 .bash_logout 4 -rw-r--r--. 1 WFUser WFUser 176 2012-04-23 11:53 .bash_profile 4 -rw-r--r--. 1 WFUser WFUser 124 2012-04-23 11:53 .bashrc 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 .cache 4 drwxr-xr-x. 5 WFUser WFUser 4096 2012-11-09 17:39 .config 4 drwx------. 3 WFUser WFUser 4096 2012-11-09 17:39 .dbus 4 -rw-r--r--. 1 WFUser WFUser 31 2012-11-09 17:39 .dmrc 4 -rw-r--r--. 1 WFUser WFUser 500 2012-02-27 12:46 .emacs 4 -rw-------. 1 WFUser WFUser 16 2012-11-09 17:39 .esd_auth 4 drwx------. 4 WFUser WFUser 4096 2012-11-09 17:40 .gconf 4 drwx------. 2 WFUser WFUser 4096 2012-11-19 16:05 .gconfd 4 drwxr-xr-x. 6 WFUser WFUser 4096 2012-11-09 17:39 .gnome2 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .gnome2_private 4 drwxrwxr-x. 3 WFUser WFUser 4096 2012-11-09 17:39 .gnote 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .gnupg 4 drwxrwxr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 .gstreamer-0.10 4 -rw-rw-r--. 1 WFUser WFUser 142 2012-11-09 17:39 .gtk-bookmarks 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .gvfs 4 -rw-r--r--. 1 WFUser WFUser 637 2012-11-09 17:39 .imsettings.log 4 drwxr-xr-x. 3 WFUser WFUser 4096 2012-11-09 17:39 .local 4 drwxr-xr-x. 5 WFUser WFUser 4096 2012-11-09 18:16 .mozilla 12 -rw-------. 1 WFUser WFUser 12288 2012-11-23 14:02 .mytests.swp 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 .nautilus 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .pulse 4 -rw-------. 1 WFUser WFUser 256 2012-11-09 17:39 .pulse-cookie 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 .spice-vdagent 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .ssh 4 -rw-------. 1 WFUser WFUser 651 2012-11-09 17:45 .viminfo 4 drwxrwxr-x. 2 WFUser WFUser 4096 2012-11-09 19:20 .vnc 16 -rw-------. 1 WFUser WFUser 13384 2012-11-19 16:05 .xsession-errors 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:42 Desktop 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Documents 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Downloads 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Music 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Pictures 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Public 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Templates 4 drwxr-xr-x. 2 WFUser WFUser 4096 2012-11-09 17:39 Videos 4 -rw-rw-r--. 1 WFUser WFUser 305 2012-11-23 14:02 mytests [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso /tmp | env LC_ALL=C sort -k9,9 -k7,8 total 44 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 2012-11-19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso /tmp | sort -k9,9 -k7,8 total 44 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 2012-11-19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Ald /tmp/.[!.]* drwxrwxrwt. 2 root root 4096 Nov 19 16:05 /tmp/.ICE-unix -r--r--r--. 1 root root 11 Nov 19 16:05 /tmp/.X0-lock drwxrwxrwt. 2 root root 4096 Nov 19 16:05 /tmp/.X11-unix drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 /tmp/.esd-500 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 /tmp/.tc -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 /tmp/.tc2 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 /tmp/.tc3 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 /tmp/.tc4 [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ (set -f; ls -lsd --sort=date /tmp/.[!.] /tmp/.?*; ls -ls --sort=date /tmp) ls: invalid argument `date' for `--sort' Valid arguments are: - `none' - `time' - `size' - `extension' - `version' Try `ls --help' for more information. ls: invalid argument `date' for `--sort' Valid arguments are: - `none' - `time' - `size' - `extension' - `version' Try `ls --help' for more information. [WFUser@RHEL63TEMP3942 ~]$ set -f; ls -lsd --sort=date /tmp/.[!.] /tmp/.?*; ls -ls --sort=date /tmp ls: invalid argument `date' for `--sort' Valid arguments are: - `none' - `time' - `size' - `extension' - `version' Try `ls --help' for more information. ls: invalid argument `date' for `--sort' Valid arguments are: - `none' - `time' - `size' - `extension' - `version' Try `ls --help' for more information. [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k10 -k7M -k8n -k9 total 44 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$
[WFUser@RHEL63TEMP3942 ~]$ export LC_ALL='C' [WFUser@RHEL63TEMP3942 ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL=C [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Incorrect [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Incorrect [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm Correct: Sort by time [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k11 -k7M -k8n -k9,10 total 44 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm [WFUser@RHEL63TEMP3942 ~]$ Sort by filename and dat time Incorrect [WFUser@RHEL63TEMP3942 ~]$ ls -Asl --time-style=long-iso /tmp | env LC_ALL=C sort -k9,9 -k7,8 total 44 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .ICE-unix 4 -r--r--r--. 1 root root 11 2012-11-19 16:05 .X0-lock 4 drwxrwxrwt. 2 root root 4096 2012-11-19 16:05 .X11-unix 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 .esd-500 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:18 .tc3 4 -rw-rw-r--. 1 WFUser WFUser 5 2012-11-16 18:15 .tc4 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:06 orbit-gdm 4 drwx------. 2 gdm gdm 4096 2012-11-19 16:05 pulse-Jkx9hhtHj4dy 4 drwx------. 2 WFUser WFUser 4096 2012-11-09 17:39 pulse-g9SlRO3UEqGg [WFUser@RHEL63TEMP3942 ~]$ ls -Asl /tmp |sort -k9,9 -k7,8 total 44 4 -r--r--r--. 1 root root 11 Nov 19 16:05 .X0-lock 4 drwx------. 2 gdm gdm 4096 Nov 19 16:05 pulse-Jkx9hhtHj4dy 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .ICE-unix 4 drwxrwxrwt. 2 root root 4096 Nov 19 16:05 .X11-unix 4 drwx------. 2 gdm gdm 4096 Nov 19 16:06 orbit-gdm 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 .esd-500 4 drwx------. 2 WFUser WFUser 4096 Nov 9 17:39 pulse-g9SlRO3UEqGg 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:14 .tc2 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:15 .tc4 4 -rw-rw-r--. 1 WFUser WFUser 5 Nov 16 18:18 .tc3 [WFUser@RHEL63TEMP3942 ~]$ [WFUser@RHEL63TEMP3942 ~]$ ls -Ald /tmp/.[!.]* ls: cannot access /tmp/.[!.]*: No such file or directory [WFUser@RHEL63TEMP3942 ~]$