bug#79710: [PATCH] ls: add --count and --count-list options to display file, directory, and symlink counts and counts with list of contents

Collin Funk <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
Pádraig Brady <[email protected]> writes:

> On 28/10/2025 15:45, Debkanta Mondal wrote:
>>   my-count-and-count-list-ls-update.patch
>> Hello Coreutils maintainers,
>> This patch adds two new options to `ls`:
>>    --count       : Display the total number of directories, files and
>> symbolic links.
>>    --count-list  : Display a detailed count + list of directories,
>> files and symbolic links present in the current directory.
>> The purpose of this update is to make it easier for users to quickly
>> see
>> object counts when listing directory contents.
>> The patch was tested on coreutils-9.3 using `make check`, and all
>> tests passed.
>> I have attached the patch file with this email.
>> Thank you for maintaining Coreutils and for reviewing my
>> contribution!
>> Signed-off-by: Debkanta Mondal ([email protected])
>
> It's hard to review this patch as it's mostly reindented changes.
> Can you resend with just the logic changes.

Likewise. The HACKING file has good formatting settings for vim.

The Emacs settings could be improved to add '(c-set-style "GNU")', among
other things.

Other editors I have tried are bad at GNU formatting.

> Can you give example outputs from the new options.
> Note new options to ls have a high bar.

My feeling is that the feature is not really needed with GNU find:

    $ find . -maxdepth 1 -type d | wc -l
    39
    $ find . -maxdepth 1 -type f | wc -l
    35
    $ find . -maxdepth 1 -type l | wc -l
    2

Collin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.