Ever wanted to write each file to standard output (stdout) but with line numbers added? nl command to the rescue.


nl /etc/hosts


1    localhost
2    test

3	# The following lines are desirable for IPv6 capable hosts
4	::1          localhost ip6-localhost ip6-loopback
5	ff02::1      ip6-allnodes
6	ff02::2      ip6-allrouters

nl stands for number lines. Review its man page to learn more. This can be achieved with many other commands too, but this one is the simplest I have ever seen in my sysadmin career. And it's always good to keep things simple, right? :)