Count Characters in File in Linux

Last updated on Dec 29, 2019 in Linux

To count characters of a text file can be done with a wc command, which stands for word count, but you can count charactes as well. These instructions apply to text files only, not binaries.

Let’s assume that your file is myfile.txt. Enter the command in the terminal:

$ wc -m myfile.txt

m stands for bytes.

The output is the number of charactes in the file. To be precise, the output is number of bytes, so line breaks for example, are counted.