In order to display the contents of a file in macOS/Linux/Unix Terminal you can make use of cat command - read more
Sample File:Lorem ipsum dolor sit amet
ut mea nostrum detracto quaestio.
Eu nobis denique fabellas est,
clita liberavisse duo an.
Nam vidit falli disputationi eu
usu nonumy nostro eirmod no.
Liber dictas incorrupte eum ex.
Qui illum singulis ei,
duo te democritum disputationi,
facer iisque aliquid ad eos.
In order to display the line numbers along with the text on the console we can make use of option -n along with the cat command and file name,
Example:$ cat -n myfile.txt
1 Lorem ipsum dolor sit amet
2 ut mea nostrum detracto quaestio.
3 Eu nobis denique fabellas est,
4 clita liberavisse duo an.
5 Nam vidit falli disputationi eu
6 usu nonumy nostro eirmod no.
7 Liber dictas incorrupte eum ex.
8 Qui illum singulis ei,
9 duo te democritum disputationi,
10 facer iisque aliquid ad eos.

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!