238 You Are Here
Figure 16.12: Redirecting the output to a file
Notice the difference (see Figure 16.12)? For one thing, there are no double entries. That’s 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 your login directory (may we suggest using ls if you want to see it listed?).
You can even use cat to read the file, by typing:
cat sneakers.txt
at the prompt.
Tip: 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’re creating doesn’t match the name
of a pre-existing file, unless you want to replace it.
Let’s use output redirection for another file and call it home.txt.
[billy@localhost billy]$ cat > home.txt
bring the coffee home
Comments to this Manuals