wc

Count lines, words, characters and bytes

About

Reports how many lines, words, characters and bytes its input holds, alone or together. It is the quickest way to size up a log or document. With several inputs it adds a total line.

Install it

Included with Termux

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

wc -l app.log Count only the lines. A fast way to see how busy a log is.
wc -w essay.txt Count whitespace-separated words in a document.
wc -c payload.json Report the byte size of the input.
wc -m notes.txt Count characters rather than bytes. That matters for non-ASCII text.
wc *.txt Report a count for each path, then a combined total.
wc -L src/main.c Print the length of the longest line. Useful for spotting runaway rows.

Worked example

Run wc *.txt and this is what you should see.

termux
$ wc *.txt
  42  210 1280 notes.txt
  17   88  512 todo.txt
  59  298 1792 total

Developed by

GNU Project .