Count Results with wc
What This Does
Count lines, words, or characters in command output or files to turn output into insight.
Why It's Useful
Turn output into insight. Quickly know how many files match, how many lines a file has, or how many results a search returned.
How to Do It
- 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 Now
Run ls ~ | wc -l to see how many items are in your home directory. The number appears instantly.
Mental Hook: Turn output into insight.