Donation?

Harley Hahn
Home Page

Send a Message
to Harley


A Personal Note
from Harley Hahn

Unix Book
Home Page

SEARCH

List of Chapters

Table of Contents

List of Figures

Chapters...
   1   2   3
   4   5   6
   7   8   9
  10  11  12
  13  14  15
  16  17  18
  19  20  21
  22  23  24
  25  26

Glossary

Appendixes...
  A  B  C
  D  E  F
  G  H

Command
Summary...

• Alphabetical
• By category

Unix-Linux
Timeline

Internet
Resources

Errors and
Corrections

Endorsements


INSTRUCTOR
AND STUDENT
MATERIAL...

Home Page
& Overview

Exercises
& Answers

The Unix Model
Curriculum &
Course Outlines

PowerPoint Files
for Teachers

Exercises and Answers for Chapter 7...

Using the Keyboard With Unix

Review Question #1:

Why is it a Unix convention to use the abbreviation "tty" to refer to terminals?

Answer

For many years (before Unix), Teletype machines were referred to as TTYs. This custom was adopted into Unix, because the very first Unix terminals were Teletype ASR33 terminals.

Review Question #2:

Why is it a Unix convention to use the word "print" to refer to displaying data on a monitor?

Answer

The earliest Unix terminals generated output printed on paper. For this reason, it became the custom within Unix to use the word "print" to describe the outputting of information. Even when more modern terminals became available and data was displayed on monitors, the word "print" was still used, and that is the case today.

Review Question #3:

What does the term "deprecated" mean?

Answer

If something is deprecated, it means that, although you can use it, you shouldn't, because it is obsolete.

You will often see the term "deprecated" in computer documentation, especially in the programming world, where things change quickly. When you see such a note, you should take it as a warning that the deprecated feature may be eliminated in future versions of the program.

Review Question #4:

How does Unix know which terminal you are using?

Answer

To keep track of what type of terminal you are using, Unix uses what is an environment variable named TERM, which is always available to the shell and to any programs you may run. The value of TERM is set to the type of terminal you are using.

To display the value of your TERM variable use the command:

echo $TERM

Environment variables are discussed in detail in Chapter 12.

Review Question #5:

Which key do you press to erase the last character you typed? The last word? The entire line?

Answer

To erase the last character you typed, press <Backspace> (or on a Mac, <Delete>).

To erase the last word you typed, press ^W.

To erase the entire line, press ^X (on some systems, ^U).

Applying Your Knowledge #1:

By default, the erase key is the <Backspace> key (or on a Macintosh, the <Delete> key). Normally, this key is mapped to ^H or, less often, ^?. Use the stty command to change the erase key to the uppercase letter "X".

Once you do this, you can erase the last character you typed by pressing "X". Test this.

What happens when you press a lowercase "x"? Why?

Now use stty to change the erase key back to the <Backspace> (or <Delete>) key. Test to make sure it worked.

Answer

To change the erase key to the uppercase letter "X":

stty erase X

Lowercase "x" won't erase because "x" is different from "X".

To change back, use:

stty erase ^H

With a Macintosh, use:

stty erase ^?

For Further Thought #1:

One way to logout is to press ^D (which sends the eof signal) at the shell prompt. Since you might do this by accident, you can tell the shell to ignore the eof signal. Why is this not the default?

What does this tell you about the type of people who use Unix?

Answer

With many programs, you press ^D (indicating that there is no more data) when you want to quit the program. Pressing ^D to logout is not the default as it would be too easy to press ^D once too often, which would cause you to logout by accident, possibly losing your work. This is especially important when you have started multiple shells, and you end each shell in turn by pressing ^D.

Many of the type of people who use Unix (especially the Unix command line) are quick thinkers who can work with multiple levels of abstraction. Such people find in handy to have a default that forces them to slow down and enter a command when they want to log out.

For Further Thought #2:

In Chapter 1, I mentioned that the first version of Unix was developed by Ken Thompson, so he could run a program called Space Travel. In this chapter, I explained that the first program to use Termcap (terminal information database) and curses (terminal manager interface) was a text-based fantasy game called Rogue, written by Michael Toy and Glenn Wichman.

Creating a new operating system and experimenting with a brand new set of interfaces are both extremely time-consuming, difficult tasks. What do you think motivated Thompson and, later, Toy and Wichman to take on such challenging work for what seem to be trivial reasons?

If you were managing a group of programmers, what motivations do you think they would respond to (aside from money)?

Answer

Smart people willingly take on such challenging work when they feel there is an adequate payoff. Superficially, the motivation may seem trivial to outsiders. However, people like Thompson, Toy and Wichman (and you and me) are willing to put in a huge amount of concentrated work to solve problems that interest them. Because such people are so intelligent, the problems that interest them are often difficult ones whose solutions are ultimately found to be extremely useful.

Most talented programmers — and other highly creative people — respond better to goals that are personally meaningful than to simple monetary compensation. This is especially true when the programmers are allowed to approach the problems in their own way at their own speed.

As a general rule, this principle is more relevant when programmers are young (and have less financial responsibilities). As programmers grow older, money often becomes more of a motivating factor than personal satisfaction.

Jump to top of page