How to count lines of a file in linux

1. nl name

nlĀ – number lines of files

2. nl synopsis

nl [OPTION]... [FILE]... 
3. nl frequently used options
-b, --body-numbering=STYLE
    use STYLE for numbering body lines
-f, --footer-numbering=STYLE
    use STYLE for numbering footer lines
-h, --header-numbering=STYLE
    use STYLE for numbering header lines 
4. nl examples
$ echo -e "one\ntwo\nthree\nfour\nfive\n\nsix" > file 

nl - create a sample file

$ nl file 

nl - add line numbers

Source taken from http://linuxconfig.org/