This command has several uses.

  1. In its most common use, it lists the contents of a file on your screen. Type:
       cat .cshrc
    to display your .cshrc file on the screen. To list any other file, repeat the command, but replace .cshrc with the name of the file.

  2. The cat command can also be used to create a new file from the keyboard. Most of the time we will use the editor to do this, but let's use cat for practice. Here is how to make a file called junk and put something in it. Type the command
       cat > junk
    (If you already have a file called junk you should use a different name.) Then type anything. For example
    This is 100% pure unadulterated junk.
    Type another line, if you want. Then end the file. To do this you must type a Ctrl-d. That is, hold down the Ctrl key while hitting the d key. That is the keyboard end-of-file signal.

    Now type ls in the window. You should see the file junk that you just created. Then type cat junk to display the file. It should be exactly as you created it.