Junior — Middle
How can you open and view the contents of a file in the Linux command line?
sobes.tech AI
Answer from AI
In Linux, there are several commands to view the contents of a file in the command line:
cat filename— displays the entire file.less filename— allows you to view the file page by page with scrolling.more filename— similar to less, but with more limited capabilities.head filename— shows the first 10 lines of the file.tail filename— shows the last 10 lines of the file.
For example, to view the file example.txt page by page, you can run:
less example.txt