How to Display Line Numbers in Linux Cat Command

The Linux cat command by default show no line numbers in its output. To display line numbers, use the -n option.

cat -n /etc/passwd

We can also concatenate files with line numbers.

cat -n /etc/passwd /etc/group

Also, we can send cat command output to a another file with line numbers.

cat -n /etc/passwd > passwd.bak