0

How to count lines in files through command prompt in Linux

Hello too all..,

is there any possible way to count no of lines in a file...? through linux command prompt....

WC command Add a comment
sathish
asked Feb 28 2017

Answer

0

Use wc

wc -l

This will output the number of lines in

$ wc -l /dir/file.txt
3272485 /dir/file.txt

Or, to omit the from the result use wc -l < :

$ wc -l < /dir/file.txt
3272485

You can also pipe data to wc as well

$ cat /dir/file.txt | wc -l
3272485
$ curl yahoo.com --silent | wc -l
63

Add a comment
linuxhelp
asked Jan 14 2019
Post your Answer