Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am currently using the following ls alias: alias ls='ls -alhGkpsq --color=auto'. This results in following directory listing.

[03:35] bryson@brys  ~ :$ ls
total 48K
4.0K drwx------ 4 bryson 4.0K Nov  2 03:34 ./
8.0K drwxr-xr-x 3 root   4.0K Apr 19  2012 ../
4.0K -rw------- 1 bryson  676 Nov  2 03:35 .bash_history
8.0K -rw-r--r-- 1 bryson   21 Nov 23  2011 .bash_logout
8.0K -rw-r--r-- 1 bryson   57 Nov 23  2011 .bash_profile
4.0K -rw------- 1 bryson   50 Nov  2 03:34 .lesshst
4.0K drwxr-xr-x 3 bryson 4.0K Nov  2 03:21 source/
4.0K drwx------ 2 bryson 4.0K Nov  2 03:23 .ssh/
4.0K -rw------- 1 bryson 1.6K Nov  2 03:23 .viminfo

The issue I have with this, which is not an issue with OS X's version of ls, is that .ssh/ is alphabetized ignoring the . in the filename.

What I would like is for ls to alphabetize the dot files all together at the top, which is where it puts . and .. as well. (Arch Linux, Bash)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Probably caused by your locale, but if you do:

LC_COLLATE=C ls -F --color=auto -l

The dot files are sorted correctly

share|improve this answer
    
Thanks. Can you explain more specifically why this works? –  Bryson Nov 2 '12 at 4:52
    
Try reading up on LOCALE settings –  darnir Nov 2 '12 at 5:13
2  
You can find some information about collating in: Does (should) LC_COLLATE affect character ranges? –  qbi Nov 2 '12 at 6:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.