Javatpoint Logo
Javatpoint Logo

Linux cat -n command (to display line numbers)

The 'cat -n' option displays line numbers in front of each line in a file.



Linux cat Display Line Number1

Look at the above snapshot, file 'jtp.txt' has a line number in front of every line by passing the command "cat -n jtp.txt".

cat -b (file name)

The 'cat -b' option removes the empty lines.



Linux cat Display Line Number2

In the previous snapshot, after line 19, line number 20 has also been marked but it is an empty line.

In the above snapshot, line 20 is removed with the help of command "cat -b jtp.txt".

Next TopicLinux cat e

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA