This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 149983 - ls missing option to list directories first
ls missing option to list directories first
Status: CLOSED UPSTREAM
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: coreutils (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-01 02:36 EST by ilja lunev
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-14 06:44:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ilja lunev 2005-03-01 02:36:44 EST
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 06:03:01 EST
> 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 16:15:18 EST
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 10:53:33 EST
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 06:44:34 EDT
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.