Showing the contents of the text file in Linux
Q. How can I see the contents of a text file in Linux while connected via ssh?
A. When you are working on a Linux computer that has a Desktop application like Gnome or KDE you can just double click on a file, and an application will open to let you edit the file.
But, when you are working on a headless machine, where you can have only access through ssh or some other text-only way, you can still read the contents of a text file. This commands come to save the day:
They are used almost the same, but the output of them differ a lot. Let’s start with
Will output the contents to the screen, and if the file is big, you will see those contents fly over the screen, and you won’t be able to read anything. If the file is short, this is your best option.
With this command, you will have a similar behavior with the difference that the content will stop screen after screen. Once the screen if full, it will stop, and you can hit ENTER in order to advance a line, or SPACE in order to advance a page (screen in this case). You can move forward, but not backwards.
This last command is like
more, but you can move backwards too, just hit the up-arrow, and you can go back in your steps, if you missed or want to re-read something.