Count with wc
Device
- Terminal
How
- Use
wc -lto count lines. ls | wc -lgives an approximate count of visible listing lines (not a robust count of all files).grep "pattern" file.txt | wc -lcounts matching lines.- Use
wc -wfor words,wc -cfor bytes, andwc -mfor characters (locale-aware).
Try this
Run printf 'é' | wc -c and printf 'é' | wc -m. On UTF-8, bytes and characters differ for that accented letter.
Why it works
Turn output into insight.