-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux wc Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to wc on Linux, covering Arch Linux, CachyOS, and other distributions including counting lines, words, characters, and file statistics.
wc (word count) counts lines, words, and characters.
Uses:
- Count lines: Number of lines
- Count words: Number of words
- Count characters: Number of characters
- File statistics: Get file info
Why it matters:
- Text analysis: Analyze text files
- Scripts: Count in scripts
- File info: Quick file statistics
Full count:
# Count lines, words, characters
wc file.txt
# Output: lines words characters filenameCount several:
# Count multiple files
wc file1.txt file2.txt
# Shows each file and totalLine count:
# Count lines only
wc -l file.txt
# Or
cat file.txt | wc -lWord count:
# Count words only
wc -w file.txt
# Word countCharacter count:
# Count characters
wc -c file.txt
# Byte countByte count:
# Count bytes
wc -c file.txt
# Same as characters for ASCIIDirectory stats:
# Count files
ls -1 | wc -l
# Number of filesCode statistics:
# Count lines in code
find . -name "*.py" -exec wc -l {} +
# Total lines in Python filesCheck installation:
# Check wc
which wc
# Usually in coreutils
# Install if missing
sudo pacman -S coreutilsThis guide covered wc usage, counting options, and file statistics for Arch Linux, CachyOS, and other distributions.
- sort Guide - Text sorting
- cut Guide - Field extraction
-
wc Documentation:
man wc
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.