Novell LINUX ENTERPRISE SERVER 10 - INSTALLATION AND ADMINISTRATION 04-08-2006 Installation Manual page 355

Table of Contents

Advertisement

• Use the set wild card to address all sample files whose last character is a number:
ls Testfile[1-9] or, using classes, ls Testfile[[:digit:]].
Of the four types of wild cards, the most inclusive one is the asterisk. It could be used
to copy all files contained in one directory to another one or to delete all files with one
command. The command rm *fil*, for instance, would delete all files in the current
directory whose name includes the string fil.
Viewing Files with Less and More
Linux includes two small programs for viewing text files directly in the shell: less
and more. Rather than starting an editor to read a file like Readme.txt, simply enter
less Readme.txt to display the text in the console window. Use
to scroll
Space
down one page. Use
and
to move forward or backward in the text.
Page Up
Page Down
To exit less, press
.
Q
Instead of less, you can also use the older program more. However, it is less convenient
because it does not allow you to scroll backwards.
The program less got its name from the the precept that less is more and can also be
used to view the output of commands in a convenient way. To see how this works, read
Section "Redirection and Pipes"
(page 355).
Redirection and Pipes
Normally, the standard output in the shell is your screen or the console window and
the standard input is the keyboard. However, the shell provides functions by which you
can redirect the input or the output to another object, such as a file or another command.
With the help of the symbols > and <, for example, you can forward the output of a
command to a file (output redirection) or use a file as input for a command (input
redirection). For example, if you want to write the output of a command such as ls to
a file, enter ls -l > file.txt. This creates a file named file.txt that contains
the list of contents of your current directory as generated by the ls command. However,
if a file named file.txt already exists, this command overwrites the existing file.
To prevent this, use >>. Entering ls -l >> file.txt simply appends the output
of the ls command to an already existing file named file.txt. If the file does not
exist, it is created.
Working with the Shell
355

Advertisement

Table of Contents
loading

This manual is also suitable for:

Suse linux enterprise server 10

Table of Contents