CSC373/406: linux: Viewing a File [24/42] Previous pageContentsNext page

There are several tools available for viewing files. The most popular command is "less" invoked as follows:

$ less foo

To scroll the contents of a file to the screen, you can use the cat command. This command gets its name from concatenate: it reads its input file name(s) and writes them to the screen. If you give it more than one file name:

$ cat foo bar

then cat will first write foo to the screen and then bar. Redirecting this output to a file (we won't go into redirection here)
like this:

$ cat foo bar > bas

would give you a file named bas whose content is the contents of bar concatenated to foo. This is a good way to add files together.

Previous pageContentsNext page