Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command has to be

ls -ld

Just from viewing the output of this, how can I determine how many files are in this directory?

share|improve this question

marked as duplicate by jasonwryan, Anthon, goldilocks, Renan, slm Nov 18 '13 at 1:34

This question was marked as an exact duplicate of an existing question.

Please don't do this: you have already asked this question: reposting it is a waste of everyone's time. – jasonwryan Nov 17 '13 at 20:14

Easily achieve with the power of grep and word count :) Although are you sure you want the d in there?

ls -ld | grep ^- | wc -l

share|improve this answer
I have stated that the command has to be ls -ld Can it be determined just from looking at the output? – John Nov 17 '13 at 20:49

Without additional arguments, ls -ld will only tell you the permissions of the current directory

cd /
ls -ld
drwxr-xr-x 23 root root 4096 Oct  7 15:57 .

If you want to find the number of entries (files, directories, links) in the current directotry, you can use

ls | wc -l

or if you just want the number of regular files

find . -maxdepth 1 -type f | wc -l
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.