Manipulating Files With - Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual

Table of Contents

Advertisement

32
Chapter 3. Shell Prompt Basics

3.8. Manipulating Files with

cat
Red Hat Enterprise Linux has a utility which can help you keep short lists, gather lists together, and
even show you information about your system.
The utility is called
, short for concatenate, which means to combine files.
cat
The command
also displays the contents of an entire file on the screen (for example, type
cat
cat
). If the file is fairly long, it quickly scrolls past you on the screen. To prevent this,
filename.txt
use the
command.
cat filename.txt | less
Using the pipe (|) and the
command together displays the file one page at a time. You can then
less
use the up and down arrow keys to move backward and forward through the pages. For more on using
pipes to combine two separate functions, refer to Section 3.9 Pipes and Pagers.
3.8.1. Using Redirection
Redirection means causing the shell to change what it considers to be standard input or where the
standard output should be going.
To redirect standard output, use the
symbol. Placing
after the
command (or after any utility
cat
¤
¤
or application that writes to standard output) directs its output to the file name following the symbol.
For example, using
by itself outputs whatever you input to the screen as if it were repeating the
cat
line you just typed. The following example shows
repeating every line that is entered:
cat
Figure 3-5. The
Command
cat
To redirect the output of
to a file, type the following at a shell prompt (pressing the [Enter] key
cat
takes you to the next blank line):
cat
sneakers.txt
¥

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents