How to see line numbers in file through cat command

How to get line numbers in file through cat command

Cat command can be used for many purposes. But do you also know you can see the line numbers in files with the help of cat command. With this method it is easy to troubleshoot or this information is also useful while creating the bash script.

Use the given below command

With cat command use -n flag


cat -n filename

Below is the screenshot of example.

cat-command

2 thoughts on “How to see line numbers in file through cat command”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.