Viewing the contents of a text file

A few different ways of listing the contents of a text file are discussed below.

  1. cat <filename> This will cause the text of the file to scroll off the screen if the text occupies more than one screen of lines. The command cat can also be used to concatenate multiple files. For example, cat <file1> <file2> will concatenate the two files and then display on the terminal.

  2. more <filename> This will display the file one screenful at a time; press the space bar to advance to the next screen; press RETURN to scroll up one line; and q to quit.

  3. less <filename> The command less is similar to the commandmore. However less allows you to move backwards in a file using the up/down arrow keys or the PageUp and PageDown keys. The command less is also faster than more on large files. (less is more, a cliche or not?)

  4. Use a text editor. For example: kwrite, vim, emacs etc.