Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to count the number of line in a file

Answer:

Use the wc command

wc -l text.txt

  1. How to count the number of duplicated lines in a file
  2. How to add line number to a text file?
  3. Count the number of matching lines from grep
  4. Count the total number of logged in user
  5. How to count the number of files in a directory?

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>