[TriLUG] file and directory count

Dan Monjar daniel.monjar at na.biomerieux.com
Fri Aug 1 09:45:51 EDT 2003


--On Thursday, July 31, 2003 04:36:07 PM -0400 Tanner Lovelace 
<lovelace at wayfarer.org> wrote:

> ls -1 | wc -l
>
> By using -1 instead of -l (that's a one instead of a letter l) it
> does not put the non-file line at the top (at least that I know of)
> so it will give you a count of all the files in the current directory
> only.

To be obsessively nit-picky, you don't need the '-1' just

	ls|wc -l

will do it.  When the output of 'ls' is not a terminal, as in a pipe, then 
the '-1' is the default.

--
Daniel Monjar
IS Manager, Technical Services
bioMérieux, Inc.
Durham, NC US
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030801/a5833cfc/attachment.pgp>


More information about the TriLUG mailing list