[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suggested feature/patch for ls: -P TYPES, --select-file-type=TYPES

From: Moreno Baricevic
Subject: Re: suggested feature/patch for ls: -P TYPES, --select-file-type=TYPES
Date: 16 Dec 2005 13:38:37 +0100

On Fri, 2005-12-16 at 09:25, Paul Eggert wrote:
> I don't recall the earlier thread, but my kneejerk reaction is that
> this sort of thing can be done fairly easily with commands like
> "ls -l | grep '^d'".  No doubt I'm missing something...

Yes, it's exactly what I wrote on my first mail about ls, find, test.

My point is that on a populated directory (e.g. /dev on 2.4), filtering
file types inside ls is faster than doing it externally by parsing a
huge output.

If d_type is supported by the file system, the additional cost for 'ls
-P' is a stat() on directories and symlinks (this allows -R, -L and the
like); otherwise (no d_type), a stat() is needed for every file (exactly
as in both "ls -l" and "find -type") but the output is what you're
looking for without further filtering.

If -P is not used, there's no cost at all for ls (other than 2 or 3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]