-->

Previous | Table of Contents | Next

Page 219

tar This is widely used for creating archives in regular files but was originally created for making tape backups. In fact, tar stands for tape archiver. Archives made by tar can be read on a wide variety of systems.
cpio Another program principally intended for backups and so on, cpio stands for copy in_out. The GNU version of cpio, which is used by Linux distributions, supports eight different data formats—some of which are varieties of its "native" format, two are varieties of tar archives, and some are obsolete. If you want to unpack an unknown archive, cpio, along with file and dd, is very useful.
dump The dump utility is of use only to system administrators because it backs up an ext2 filesystem by raw access to the block device on which the filesystem exists. (For this reason, it is better to do this when the filesystem is either not mounted or is mounted read-only.) This has the advantage, among other things, that the access times of the backed-up directories are left unmodified. (GNU tar will also do this.) Although tapes written with dump are not always readable on other versions of UNIX, unlike those written by tar and cpio, this is a popular choice.
dd Designed for blockwise I/O, dd is a general-purpose tool for doing file manipulations and can often be very useful.
afio A variant of cpio that compresses individual files into the backup. For backups, this is preferable to tar's compression of the whole archive because a small tape error can make a compressed tar archive useless, although a tar archive that isn't compressed doesn't have this vulnerability. This isn't very widely used outside the Linux world.
Amanda Amanda is a powerful backup system that schedules, organizes, and carries out backups for you. It uses either tar or dump to do the actual work, and will effortlessly allow you to automate all the backups for one machine or a multitude. One of its most useful features is its capability to do fast backups across the network from several client machines to a single server machine containing a tape drive. More information about Amanda is available at the URL http://www.cs.umd.edu/projects/amanda/; RPMs of Amanda are available on the Red Hat FTP site.
BRU BRU (Backup and Restore Utility) is a commercial product for making backups.

Page 220

Terminals

The terminal is the principal mode of communication between the kernel and the user. When you type keystrokes, the terminal driver turns them into input readable by the shell, or whatever program you are running.

For many years, UNIX ran only on serial terminals. While most computers now also have video hardware, the terminal is still a useful concept. Each window in which you can run a shell provides a separate pseudo-terminal, each one rather like a traditional serial terminal. Terminals are often called ttys because the device nodes for many of them have names like /dev/tty*.

The terminal interface is used to represent serial lines to "real" terminals, to other computers (via modems), mice, printers, and so on. The large variety of hardware addressed by the terminal interface has led to a wide range of capabilities being offered by the terminal device driver, and hence explaining all the facilities offered could easily occupy an entire chapter. This section just offers an overview of the facilities.

For more complete information on terminals and serial I/O, refer to the Linux Documentation Project's excellent HOWTO documents. These are provided on the Red Hat Linux 4.2 CD-ROM and are also available on the Web at http://sunsite.unc.edu/LDP/. Specific HOWTOs dealing with this are the Serial-HOWTO, section 9 of the Hardware-HOWTO, and the Serial Port Programming mini-HOWTO. There are many documents dealing with using modems for networking. These are mentioned later in the chapter in the section "Using Modems."

The Terminal Device Driver

The terminal device driver gathers the characters that you type at the keyboard and sends them on to the program you're working with, after some processing. This processing can involve gathering the characters into batches a line at a time and taking into account the special meanings of some keys you might type.

Some special keys of this sort are used for editing the text that is sent to the program you're interacting with. Much of the time, the terminal driver is building a line of input that it hasn't yet sent to the program receiving your input. Keys that the driver will process specially include the following:

Return (CR) or Line feed (LF) CR is usually translated into LF by the terminal driver (see the icrnl option in the manual page for stty). This ends the current line, which is then sent to the application (it is waiting for terminal input, so it wakes up).

Page 221

Backspace/Delete Only one of these two keys can be selected as the erase key, which erases the previous character typed. For more information, read the Linux Keyboard Setup mini-HOWTO.
End-of-File, usually Ctrl+D When a program is reading its standard input from the keyboard, and you want to let it know that you've typed everything that you're going to, you press Ctrl+D.
Word-erase, usually Ctrl+W Deletes the last word you typed.
Kill-Line, usually Ctrl+U This kills the entire line of input so that you can start again.
Interrupt, usually Ctrl+C Kills the current program. Some programs block this at times when the program might leave the terminal in a strange state if it were unexpectedly killed.
Suspend, usually Ctrl+Z This key sends a suspend signal to the program you're using. The result is that the program is stopped temporarily, and you get the shell prompt again. You can then put that program (job) in the background and do something else. See Chapter 21, "Shell Programming," for more information.
Quit, usually Ctrl+\ (Ctrl+Backslash) Sends a Quit signal to the current program; programs that ignore Ctrl+C can often be stopped with Ctrl+\, but programs ignoring Ctrl+C are often doing so for a reason.
Stop, usually Ctrl+S, and Start, usually Ctrl+Q These stop and restart terminal output temporarily, which can be useful if a com- mand produces a lot of output, although it can often be more useful just to repeat the command and pipe it through less.

There are many other terminal modes and settings; these can be examined with the stty command. This command has a built-in set of sensible settings for terminals, and normally when you just type stty to find the current settings, it just shows you the differences from its "sane" settings:


$ stty

speed 9600 baud; line = 0;

Previous | Table of Contents | Next