How to get the number of Words, Characters and Rows within a text file on Linux via the Command Line

H
  • Knowledge Base
  • Linux
  • How to get the number of Words, Characters and Rows within a text file on Linux via the Command Line
  • By using the wc command.
    wc = print newline, word, and byte counts for each fileĀ 
  • In the CLI type in the following command:
    wc -wcl < /home/user/textfile.txt

    textfile.txt = The file that we need to get the information from
    -w = print the word count
    -c = print the character count
    -l = print the line count

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me