Re: list files but not directory

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

 



On Sat, 2009-08-22 at 03:59 -0400, William Case wrote:
> Hi Tim;
> On Sat, 2009-08-22 at 16:58 +0930, Tim wrote:
> > On Fri, 2009-08-21 at 10:35 -0400, William Case wrote:
> > > It seems illogical, that 'ls' wouldn't have a flag that just shows
> > > files when it has a flag for directories.
> > 
> > Though that flag "ls -d" has a completely different purpose (show
> > directory names, rather than go into them and list their contents).
> > 
> True.  But whatever its purpose, it does give me a list of directory
> names.

In fact it lists *all* its arguments as usual (the default being ".", as
always), except that those which are directories are not listed
recursively. It doesn't "give a list of directory names", unless that's
what the arguments happen to be.

There are no flags to ls which mean "ignore any arguments which belong
to this class of object".

> All that I am saying is that it would be handy to have a simple util
> that listed file names.

If you want to filter out directories, use grep, as several people have
pointed out. That's the Unix Way (tm).

>  I suggest 'ls' because it is probably the most
> used and first learned listing utility and therefore would be the place
> to have it.  It would be useful to beginners (particularly those who do
> not yet have any idea what a regexp is) and for script writing or piping
> to sed, awk, grep or a new file (or for appending).

Said beginners need to learn that *directories are files* (and devices
are files, named pipes are files, etc.). This is an important concept
which should not be hidden.

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux