You can use less -N or –LINE-NUMBERS option to display a line number at the beginning of each line in the display.
1 2 3 4 5 6 7 8 9 10 11 12 |
## create a long file with 200 lines > myfile; i=1; while [ $i -le 200 ]; \ do echo "$i" >> myfile; ((i++)); done ## default less myfile ## line number is not displayed by default ## less -N or --LINE-NUMBERS options less -N myfile ## line number is displayed at the begining ## of each new line rm myfile |