Count with wc
How
- Use
wc -lto count lines - For example:
ls | wc -lcounts files in the current directory - Or:
grep "pattern" file.txt | wc -lcounts matching lines - Use
wc -wfor words,wc -cfor 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.