Determining how many characters are in a file is easy on the Linux command line: use the ls -l command.
On the other hand, if you want to get a count of how many times each character appears in your file, you’re going to need a considerably more complicated command or a script. This post covers several different options.
Counting how many times each character appears in a file
To count how many of each character are included in a file, you need to string together a series of commands that will consider each character and use a sort command before it counts how many of each character are included.
To do that, you can use a command like this one:
Source:: Network World – Linux