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

Table of Contents

Advertisement

Sometimes it is also useful to use a file as the input for a command. For example, with
the tr command, you can replace characters redirected from a file and write the result
to the standard output, your screen. Suppose you want to replace all characters t of
your file.txt from the example above with x and print this to your screen. Do so
by entering tr t x < file.txt.
Just like the standard output, the standard error output is sent to the console. To redirect
the standard error output to a file named errors, append 2> errors to the corre-
sponding command. Both standard output and standard error are saved to one file named
alloutput if you append >& alloutput.
Using pipelines or pipes is also a sort redirection, although the use of the pipe is not
constrained to files. With a pipe (|), you can combine several commands, using the
output of one command as input for the next command. For example, to view the contents
or your current directory in less, enter ls | less. This only makes sense if the
normal output with ls would be too lengthy. For instance, if you view the contents of
the dev directory with ls /dev, you only see a small portion in the window. View
the entire list with ls /dev | less.
18.1.5 Archives and Data Compression
Now that you have already created a number of files and directories, consider the subject
of archives and data compression. Suppose you want to have the entire test directory
packed in one file that you can save on a USB stick as a backup copy or send by e-mail.
To do so, use the command tar (for tape archiver). With tar --help, view all the
options for the tar command. The most important of these options are explained here:
-c
(for create) Create a new archive.
-t
(for table) Display the contents of an archive.
-x
(for extract) Unpack the archive.
-v
(for verbose) Show all files on screen while creating the archive.
356
Installation and Administration

Advertisement

Table of Contents
loading

This manual is also suitable for:

Suse linux enterprise server 10

Table of Contents