Manipulating Information From The Shell - Red Hat ENTERPRISE LINUX 4 - STEP BY STEP GUIDE Manual

Table of Contents

Advertisement

60
The main difference between
using the same navigation as man pages: press the [Space] bar to go down one page, the [B] to go
back one page, the directional (or "arrow") keys to move one line at a time, and [Q] to quit.
To search the output of a text file using
file.
/stuff
The above command would search through the file for all instances of "stuff" and highlight them in
the text.
4.8.5. Viewing and creating files with
The
command is a versatile utility. It can be used to view text, to create text files, and to join files.
cat
Its name is short for concatenate, which means to combine files.
Using
alone echoes on the screen any text you enter. It will continue to do so until you exit with
cat
the [Ctrl]-[D] keystroke.
Entering the
command followed by a file name displays the entire contents of the file on the
cat
screen. If the file is long, the contents scroll off the screen. You can control this by using the redirection
techiniques that are discussed in Section 4.9 Manipulating Information from the Shell.
4.8.6. The
grep
The
command is useful for finding specific character strings in a file. For example, to find every
grep
reference made to "pattern" in the file
grep pattern < filename >
Each line in the file that includes the pattern "pattern" is located and displayed on the screen/

4.9. Manipulating Information from the Shell

From the shell's point of view, there are three kinds of information: standard input, standard out-
put, and standard error. In simple terms, standard input is the information that a user enters from
the keyboard for the shell to use, such as commands and filenames. Standard output is essentially the
information the shell prints on the screen after evaluating a user's commands. Standard error is the in-
formation that indicates that something has gone wrong. Collectively, these three types of information
are referred to as standard I/O (input/output).
The ability to manipulate and use information from the shell is one of the strengths of Red Hat Enter-
prise Linux. This section discusses the simpler aspects of standard I/O manipulation.
4.9.1. Pipes and Pagers
In Section 4.8.5 Viewing and creating files with
the contents to scroll off the screen. Using a pipe, we can control that behavior. A pipe is the ( | )
symbol. It is used to connect the standard output of one command to the standard input of another
command. Essentially, it allows a user to string commands together. Pagers are commands (such as
) that display text in the terminal window.
less
and
more
less
less
Command
< filename >
is that
allows backward and single-line movement
less
, press [/] and enter the keyword to search for within the
cat
, enter:
, we saw that using
cat
Chapter 4. Shell Prompt Basics
to view a large file causes
cat

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 4

Table of Contents