Do you want to show line numbers in front of each line in a file in #Linux, #macOS, #FreeBSD or #Unix? Try
cat -n /etc/passwd
nl /etc/passwd
sed -n 3,5p /etc/resolv.conf | nl
See https://www.cyberciti.biz/faq/cat-line-numbers-and-ranges-under-unix-linux/ for more info.
