Write a command to find the total number of lines in a file?

wc -l filename
Other ways to pring the total number of lines are
awk ‘BEGIN {sum=0} {sum=sum+1} END {print sum}’ filename
awk ‘END{print NR}’ filename

Category: UNIX Interview Questions.