Displaying Text from File(s) to the Screen


  
"To my daughter Leonora:
Without whose never failing sympathy and encouragement,
this book would have been completed in half the time"
- P.G. Wodehouse


Of course, to be of use, files must be accessed and 
looked into.  You can always open a text editor and read 
the content of a text file, but most times, you just want 
to take a quick look the file.  To read/print the contents 
of a file on your screen, you can use either the 
"cat" (=catenate) 
or the "more" 
command or the 
"less" command or the 
"page" command.  For example:

$ cat foo.txt
$ more foo.txt
$ less foo.txt
$ page foo.txt

will display the contents of a file "foo.txt" on your screen.

Catenate means "to connect in a series." The "cat" command displays the contents of a file. If more than one file is placed in the command line, i.e., "cat jimmy shook," -- FYI, "jimmy" and "shook" refer to male and female Chesapeake blue crabs -- the files are displayed in succession. (of course, file "jimmy" first, then file "shook") It is here that "cat" command derives its name.

$ cat jimmy shook

Either command works, but "more" or "less" or "page" is the intelligent version.

With "more" or "less" or "page," the system stops at the end of a screenful and wait for you to hit a key to continue. If you use "cat, " everything flies by without stopping. (of course you can use to pause the screen and to resume, but this can be annoying)

Using "more" or "less" or "page, " there are several keys that make more continue in different ways. key makes more only print out one additional line and then pause again. gives you a full screenful.

When using "more/less/page" and "cat" you must be careful. Any file that is not a text file should not be viewed through "more/less/page" or "cat." (such as binary file)

If you're not so sure what kind of file you're dealing with, you can use "file" command first to determine file type before displaying the file.