Harley Hahn's Guide to
|
A Personal Note
Chapters...
Command
INSTRUCTOR |
Exercises and Answers for Chapter 8... Programs to Use Right Away Review Question #1: Describe three different ways that are used to stop a program. Answer Three ways commonly used to stop a program are:
• Using the built-in quit command (q or quit)
Review Question #2: Which program do you use to display the time? The date? Answer Use the date program for both. Review Question #3: What is the difference between the cal and calendar programs? Answer The cal program displays a calendar. The calendar program offers a reminder service. Review Question #4: How do you display the name of the computer you are using? Your operating system? Your userid? Answer Display the name of the computer you are using: hostname Display information about your operating system: uname Display your userid (use either of the commands):
whoami
(The id program is explained in Chapter 25) Applying Your Knowledge #1: Mickey Mouse was born on November 18, 1928. Display the calendar for that month. What day of the week was Mickey born on? What number day within the year was it (Jan 1 = 1, Dec 31 = 366)? Answer Display a calendar for November 1928: cal 11 1928 By reading the output, you can see that November 18, 1928 was a Sunday. Display Display a calendar for November 1928 showing the numxber of each day within the year: cal -j 11 1928 By reading the output, you can see that November 18, 1928 was day #323. Applying Your Knowledge #2: The element lutetium is a very heavy, rare, silvery white metal. It is considered to be the most expensive metal in the world. The Maharaja of Gaipajama wants you to babysit with his son. The fee will be 1 gram of lutetium for every 2 hours, and he wants you to work for 5 hours. Assume that gold costs $25.42 (U.S.) per gram, and 1 gram of lutetium is worth 6 grams of gold. Use the bc program to calculate how much your babysitting fee worth in U.S. dollars. The answer must be accurate to 2 decimal places. (Once you are finished, look up the Maharaja of Gaipajama on the Internet.) Answer The babysitting fee is $381.30. To calculate it:
bc
The Maharaja of Gaipajama is a minor supporting character in several Tintin books. The Maharaja and Tintin work together to fight a powerful drug-smuggling organization. The Maharaja of Gaipajama appears in Cigars of the Pharaoh, The Red Sea Sharks, and at the beginning of The Blue Lotus. In the books, Gaipajama is an administrative region in India of which the Maharaja is the ruler. (Now you can look up Tintin.) For Further Thought #1: At the beginning of the chapter, I made the comment, "Traditionally, one of the ways in which people learn Unix is by having a good time while they are learning." This is usually not the case with other operating systems, such as Microsoft Windows. Why? Answer Unix was designed by programmers to use for themselves. Windows was designed for non-technical home users and for business users, two groups that do not expect (nor desire) to have a good time which learning how to use a computer. For Further Thought #2: The users, who and w programs all display information about the userids that are currently logged into the system. Do we need three different programs? Answer Probably not. It would be sufficient to have one program with appropriate options. However, because each program shows different information by default, it is handy to be able to enter a command with no options that displays exactly what you want (once you have learned all three commands). Exercises: Introduction | Chapter list
© All contents Copyright 2024, Harley Hahn
|