Using cat

There's a handy utility which can help you keep short lists, gather those lists together and, at the same time, show you a little of the power behind your Red Hat Linux system.

The utility is called cat, short for "concatenate," which means that it strings files together.

But cat can also perform a quick demonstration of two important terms: standard input and standard output.

Standard input and standard output direct input and output (often referred to as I/O) to the user. If a program reads from standard input, it will, by default be reading from the keyboard. If a program writes to standard output, by default it will be writing to the screen.

Start cat to see what this means. At the shell prompt, type:

cat
	  

The cursor moves to a blank line. Now, in that blank line, let's type:

stop by sneaker store
	  

and press the Enter key. Your screen will look like:

[billy@localhost billy]$ cat
stop by sneaker store
stop by sneaker store
	  

Figure 3-11. cat Demonstrates Standard Input and Standard Output

To quit cat now, just move the cursor to a blank line by pressing Enter then press the Ctrl and D keys at the same time.

So it's not too exciting. But cat has just demonstrated the definition of standard input and standard output. Your input was read from the keyboard (standard input), and that input was then directed to your terminal (standard output).

Summary: Standard input is often text which is entered from the keyboard. Standard output is the place where information is sent, such as your terminal (as shown in Figure 3-11).