Quite often we want to look at a file. Which is fine for text files, but not so fine for binary files. How do we tell the difference? Some operating systems require the name of the file to specify its contents. UNICES don't do this, although some programs used on the various UNICES do.
There is a program called file, which will try to tell you what kind of file you have. While working on this book at this point, some of the files in my working directory were:
Beginner.aux: ASCII text Beginner.doc: ASCII text Beginner.dvi: TeX DVI file (TeX output 1999.09.17:2036‹) Beginner.find: ASCII text Beginner.log: TeX transcript text Beginner.pl: perl commands text Beginner.tex: LaTeX document text Beginner.toc: ASCII text Beginner.txt: English text begin.this: English text bl: symbolic link to begin.thisThe above shows that some of the files are text, in fact it has different kinds of text. And we also see that the file command can see if a directory entry is really a symbolic link. In general, if any file is some kind of text, it is probably okay to try to view or read the file.
The simplest command to display a file is the cat command. To view the Beginner.tex file using cat, I would type:
cat Beginner.texThis would be very useful, as this file was much longer than 24 lines long, and it would just go screaming past (if you were doing this on the ``console'': over a 300 baud serial link you could probably read it).
A long time ago someone realized it might be convenient to display a text file by ``pages'', and so they wrote the pg command. My SuSE 5.3 system no longer even has this command, but it was a pretty bare bones program. Somebody thought it would be nice if pg could do more, if it could search through the text and things like that. So they wrote an improved version, and they called this newer program more. More is a program which exists on most UNICES. An even more advanced program was written, and using some strange logic (or humour) it was called less.
You can also examine or view files using any of the editors, and quite a few other methods. But cat, more and less are the most usual ones.