Reading files is basic and a must when working on the terminal in Linux or command line.
There are a lot of ways to do this, a simple task but quite a few ways to accomplish it.
Nano, vi/vim the most common editor in Linux that is part of the package in most Linux flavors if not all.
In nano editor, while the file is open pressing "alt + n", will display the line numbering on the left side of the screen.
Example image:
Or from the command line itself using "cat -n any_file_name.txt" will also view line numbers the -n is a parameter on cat to view or include the line numbers when displaying the file.
Example image:
That's it no need to remember any parameters, just two letters: "nl plus_any_file_to_view.txt"
It's quite useful, when trying to check if let's say some error on a Python file or Bash Script on a particular line number, and see whether it's just a semi-colon, or a space indentation that is causing the issue.
Till next time, keep learning and exploring.
Always remember to Pray, whether life is good or life is hard or no matter whether it make sense or not. God is always listening.
And remember Sin is like a credit card enjoy now, Pay/Suffer later.
Don't be afraid to repent though, God is merciful.
Fiat Voluntas Tua | Catholic Prayers & Quotes


Comments
Post a Comment