Bug 149983 - ls missing option to list directories first
Summary: ls missing option to list directories first
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: coreutils
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-01 07:36 UTC by ilja lunev
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-14 10:44:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description ilja lunev 2005-03-01 07:36:44 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707

Description of problem:
The good old 'ls' command has many options but there are missing some essential things.
1. There is no option to get a properly ascii sorted output (see examples below). Instead it relies on the LANG variable
2. On HP-UX a regular 'ls' done as super-user always lists all files (except . and ..). There is no option for this on Linux.
3. There is no option to get directories before files (like windows does it)

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
just do an 'ls' or 'ls -a'
  

Actual Results:  LANG=en_US ls -a 
.           .B          !!CTestFile  eTestFile   .g
..          bTestFile   .d           !eTestFile  !!GdTestFile
.a          !bTestFile  dTestFile    @eTestFile  gTestFile
aTestFile   @bTestFile  !dTestFile   .f          !gTestFile
!aTestFile  .c          @dTestFile   fTestFile   @gTestFile
@aTestFile  cTestFile   @DTestFile   !fTestFile
@ATestFile  !cTestFile  .e           @fTestFile
.b          @cTestFile  .E           !FTestFile


Expected Results:  root ls under HP-UX
!!CTestFile   !eTestFile    .c            @aTestFile    aTestFile
!!GdTestFile  !fTestFile    .d            @bTestFile    bTestFile
!FTestFile    !gTestFile    .e            @cTestFile    cTestFile
!aTestFile    .B            .f            @dTestFile    dTestFile
!bTestFile    .E            .g            @eTestFile    eTestFile
!cTestFile    .a            @ATestFile    @fTestFile    fTestFile
!dTestFile    .b            @DTestFile    @gTestFile    gTestFile


Additional info:

Comment 1 Tim Waugh 2005-03-01 11:03:01 UTC
> 1. There is no option to get a properly ascii sorted output (see examples
below). Instead it relies on the LANG variable

You can set the LC_COLLATE=C variable to get ASCII sorting without affecting
other locale variables (see POSIX).

> 2. On HP-UX a regular 'ls' done as super-user always lists all files (except .
and ..). There is no option for this on Linux.

I think the -A option does what you want.

> 3. There is no option to get directories before files (like windows does it)

This feature enhancement has been requested previously, for example:
  http://lists.gnu.org/archive/html/bug-coreutils/2004-03/msg00033.html


Comment 2 Juliano F. Ravasi 2005-03-05 21:15:18 UTC
I also would like an option to sort directories first, but it seems
that coreutils people dislike it and ignores every patch or message
that suggests this addition (which is quite trivial).

Comment 3 Tim Waugh 2005-03-07 15:53:33 UTC
The main objection I think is that sort-directories-first isn't orthorgonal to
sort-by-name/size/date etc.

In other words: What if someone wants this option, but with things sorted on
size or extension, rather than on name?


Comment 5 Tim Waugh 2005-05-14 10:44:34 UTC
Closing as 'upstream', since this issue is known to the upstream developers.


Note You need to log in before you can comment on or make changes to this bug.