Count with wc

How

  1. Use wc -l to count lines
  2. For example: ls | wc -l counts files in the current directory
  3. Or: grep "pattern" file.txt | wc -l counts matching lines
  4. Use wc -w for words, wc -c for characters

Try this

Run ls ~ | wc -l to see how many items are in your home directory. The number appears instantly.

Why it works

Turn output into insight.

Open full demonstration ↗