Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual page 47

Table of Contents

Advertisement

Chapter 3. Shell Prompt Basics
Figure 3-6. Redirecting Output to a File
Press [Enter] to go to an empty line and use the [Ctrl]-[D] key combination to quit
Do you notice anything different in Figure 3-6? There are no repeated entries. That is because the
standard output from cat was redirected. That redirection was to a brand new file you made called
.
sneakers.txt
You can find the file in the directory you were in when you started
listed).
As you learned earlier, you can also use
cat sneakers.txt
Caution
Be careful when you redirect the output to a file, because you can easily overwrite an existing file!
Make sure the name of the file you are creating does not match the name of a pre-existing file, unless
you want to replace it.
Use output redirection again for another file and call it
mand
cat > home.txt
bring the coffee home
take off shoes
put on sneakers
make some coffee
relax!
Now, on an empty line, use the [Ctrl]-[D] key combination again to quit
Next, use
to join
cat
new file called
saturday.txt
cat sneakers.txt home.txt
cat
, then [Enter], followed by:
with
home.txt
sneakers.txt
(as seen in Figure 3-7). Type the following:
saturday.txt
¦
to read the file you have created. At the prompt, type:
home.txt
and redirect the output of both files to a brand
.
cat
(type
if you want to see it
cat
ls
. For this example, type the com-
.
cat
33

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents