Command to know how many lines, words and letters or characters a file has

Here I bring you another interesting tip 🙂

I don't know about you, but sometimes I need to know how many words or how many characters a file has, for this we can use the Libre Office Writer, or use our text editor if it gives us this information, but in Linux we will always have more options for the ones we know ... that's why I bring you here a command that will tell us this 🙂

For example, we have the file file.txt containing:

<° Linux (aka DesdeLinux) is a site dedicated to topics related to Free Software and Technologies.

Our goal is none other than to provide all those users who are new to the world of GNU / Linux, a place where they can acquire new knowledge in the easiest way possible.

If we execute wc and we pass the file path, it will give us:

  • Number of lines in the file
  • Number of words in the file
  • Number of characters in the file

Let's see a screenshot 😀

As you can see, this has 3 lines (2 text and one at the end empty), as well as 50 words and a total of 302 characters. Characters include letters, numbers, symbols, and spaces 😀

Well ... nothing more to add 😉

I hope you find it interesting.

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   seachello said

    I used it quite a bit to process chain program outputs with a pipe.

    For example program> output; cat output | grep pattern | toilet

    Very useful

  2.   hackloper775 said

    With Unix pipes you can do something similar but this command that you show will help me a lot thanks

    regards

    1.    KZKG ^ Gaara said

      A pleasure to help 🙂

      1.    Damian rivera said

        I was going to use this

        http://pastebin.com/nHeAs2qk

        worked with a bash script to call the file, since I did not know that wc function, I always only did wc -l to convert lines into text

        I should start using more "man"

        Thanks and Regards again

        1.    Damian rivera said

          To convert lines into text? I meant to see the lines of a text, going back to the man thing, already checke and it also has –help, a tutorial on wc would be good since it is seen that it is very useful

  3.   abrahamtamayo said

    Thank you very much .. Thank you very much .. something so simple but so useful ..