Chapters 3&7&13 ExercisesRead Chapters 3, 7 and 13 of the Unix text and work on the Unix system. Make sure you can answer the following questions:
Chapter 3 - Basic Utilities
3-1 If the following three lines are sorted with -d option, how would they be ordered?
Once upon a time, ++Good Chocolate Cake was considered to be "the only food a College Student would ever need."
3-2 State the command that will sort the first 30 records of /etc/passwd file by its 4th field (only) in an ascending order.
3-3 Why is that the uniq utility eliminates more records if the input file is sorted?
3-4 State the command that will display only those records that are common to both file1 and file2.
3-5 State the command that will change all characters in file myfile to lower case.
3-6 State the command that will display the lines of a file named myfile with each line numbered.
3-7 Do the Review Exercises on pages 194-5.
3-8 What does grep stand for?
3-9 State the command syntax of grep. (What is the first argument interpreted as? What are the second and following arguments?)
3-10 Explain the options -i, -l, and -v for the grep utility.
3-11 Explain the options -f, -c and -d for the cut utility.
3-12 Skip Section 3.11 (p. 202-208) as it is not
possible to print in the computer labs from our ACADAIX Unix system.
3-13 What is the default field for joining records of two files?
3-14 What kind of order must the files be in order to be joined by the join command?
3-15 If you join a 4-record file with a 6-record file, what is the maximum possible number of records that the joined file would contain?
3-16 State the command that will replace all ( ) by [ ] in file called Story. There may be words between ( )s.
3-17 State the command that will replace all instances of the characters "practice" to "docum" in the file called myfile.
3-18 Explain the differences between cut and awk.
3-19 State the command that will display the 5th field followed by the first field of the last 10 records of the /etc/passwd file.
3-20 What is the option used by awk to specify the field separator?
3-21 Which command can send its input to standard output (usually the terminal) as well as an output file?
3-22 Do the Review Questions listed on page 222.
3-23 State the command that will list all of the subdirectories only (no files) of the current directory.
3-24 State the command that will list all of the files only (no subdirectories) of the current directory.
3-25 State the command that will place all online users in a file onusers and place a sorted version of the same data in a file named sortedusers.
3-26 State the command that will replace each blank space with a line feed character in a file called myfile.
3-27 State the command that will delete all blank lines in a file called myfile.
3-28 Construct the script file WordsUsed of section 3.18. Test it to make sure it works. Redirect the output of "man more" into a file and use the script to count how many unique words there are in this file.
3-29 If you include the dash (-) in the first line of WordsUsed along with ",;?. and test it on the file created in the previous question, how many unique words are there now?
Chapter 7 - Obtaining Help from the On-line Manual
7-1. What does the command name man stand for?
7-2. How can you use the features of the pager program to search for keywords in a manual page as you view it on your screen? (Usually the pager program used to view manual pages is the Unix utility more. How can you search the text you are viewing using more?)
7-3. Call up the on-line manual page for vi on ACADAIX and search for the entry Entering Shell Commands. (Keep the case of the search text.) Explain how to enter the shell and exit back to vi. Explain also how you would issue one shell command and back to vi.
7-4. How can you redirect the output of the man command into a file?
Chapter 13 - Accessing and Changing Previous Commands
13-1. How do you start a C shell? How do you exit the C shell?
13-2. State the Korn shell command to set the size of the history list to contain 50 previous commands.
13-3. What command will list the commands stored in the history list?
13-4 State the command to change the shell prompt to include the history event number for each command.
13-5. The command that you want to repeat has an event number 7. Name the shortest way to repeat that command in Korn shell.
13-6. (Skip 13.3 - 13.4 of p.599-607) Name two ways to add arguments to the last issued command.
13-7. Which Korn shell variable must be set to enable the use of vi-like commands to modify previously issued commands?
13-8. Explain how to search for the word practice in the history list?
13-9. Do the Review Questions on page 610.
These exercises were originally created by Maitang Mark
Web Author: Ian! D. Allen email@example.com