Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux wc command

Count lines, words, and bytes. Use -l for a line count only.

GNU Coreutils

Syntax

Command form
wc [OPTION]... [FILE]...

Common options

5 options
OptionWhat it does
-l, --linesPrint newline counts.
-w, --wordsPrint word counts.
-c, --bytesPrint byte counts.
-m, --charsPrint character counts.
-L, --max-line-lengthPrint the maximum line width.

Usage examples

2 examples

Count lines, words, and bytes. Use -l for a line count only.

wc -l access.log

Count words in a text file.

wc -w README.md

Notes

Byte counts and character counts differ for multibyte text. Without a filename, wc reads standard input.