Workshop

The Workshop summarizes the key terms you learned and poses some questions about the topics presented in this chapter. It also provides you with a preview of what you will learn in the next hour.

Key Terms

block special device A device driver that controls block-oriented peripherals. A hard disk, for example, is a peripheral that works by reading and writing blocks of information (as distinguished from a character special device). See also character special device.

character special device A device driver that controls a character-oriented peripheral. Your keyboard and display are both character-oriented devices, sending and displaying information on a character-by-character basis. See also block special device.

control key notation A notational convention in UNIX that denotes the use of a control key. There are three common conventions: Ctrl-C, ^c, and C-C all denote the Control-c character, produced by pressing the Control key (labeled Control or Ctrl on your keyboard) and, while holding it down, pressing the c key.

core dump The image of a command when it executed improperly.

interactive program An interactive UNIX application is one that expects the user to enter information and then responds as appropriate. The ls command is not interactive, but the more program, which displays text a screenful at a time, is interactive.

major number For device drivers, the major number identifies the specific type of device in use to the operating system. This is more easily remembered as the device ID number.

minor number Once the device driver is identified to the operating system by its major number, the address of the device in the computer itself (that is, which card slot a peripheral card is plugged into) is indicated by its minor number.

null character Each character in UNIX has a specific value, and any character with a numeric value of zero is known as a null or null character.

pipeline A series of UNIX commands chained by |, the pipe character.

Exercises

1:Many people who use UNIX systems tend to stick with file-naming conventions. Indeed, UNIX has many of its own, including .c for C source files, .Z for compressed files, and a single dot prefix for dot files. Yet file ignores filenames (test it yourself). Why?
2:Use more to check some of the possible file types that can be recognized with the file command by peeking in the configuration file /etc/magic.
3:Do you remember the television game show “Name That Tune?” If so, you'll recall how contestants had to identify a popular song by hearing just the first few notes. The file command is similar; the program must guess at the type of the file by checking only the first few characters. Do you think it would be more accurate if it checked more of the file, or less accurate? (Think about this one.)
4:How did the cat command get its name? Do you find that to be a helpful mnemonic?
5:Here's an oddity: what will this command do?
cat LISTS | more

6:If you were looking at an absolutely huge file, and you were pretty sure that what you wanted was near the bottom, what command would you use, and why?
7:What if the information was near the top?

Preview of the Next Hour

There are lots of special characters in UNIX, as you have doubtless learned by accidentally typing a slash, an asterisk, a question mark, a quotation mark, or just about any other punctuation character. What may surprise you is that they all have different specific meanings. The next hour explains considerably more about how pipelines work and how programs are used as filters. Among the new commands you will learn are sort, wc, nl, uniq, and spell. You also will learn a new, immensely helpful flag to cat that makes cat produce line numbers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset