Displaying the Contents of a File with cat and less
To view the contents of a text file named testfile on your screen, assuming that you are the user hadi, use this command:
Text inside testfile is displayed on the screen but you cannot edit or work with the text. This command allow you to know the contents of a file but don’t want to make any changes.
When need to view the contents of a longer text file from the command line, you can use less. This produces a paged output, meaning that output stops each time your screen is full. You can then use your up and down arrow keys and page-up and page-down keys to scroll through the contents of the file.
Then, use q to quit and return to the command line: