Chapter 3 Review Questions
1. The default shell used by Linux is (b) The Bourne Again Shell (bash).
2. When logged in as root, the shell prompt normally changes to display (b) #.
3. The main function of a shell is to (d) start programs.
4. Name four different shells and briefly describe the differences between them.
a. Sh is the original UNIX shell.
b. Bash an enhanced version of the Bourne shell. It has history and tab completion.
c. Csh, or c shell, is a newer shell with easy to use interactive features. But it has a more complex syntax than Bourne shells. It is based on the c programming language.
d. Tcsh is the tenex/tops c shell. It is an enhancement of the c shell and is commonly used on Linux systems.
e. Ksh is the Korn shell and it is a combination of the Bourne shell and the interactive features of the c shell.
5. Tab completion is useful when you need to (c) enter long file names or directory names at the shell prompt.
6. The history command is used to (a) display a list of previously entered commands.
7. Entering the command !fr would do the following in the bash shell (b) re-execute the most currently executed command that began for "fr".
8. To have a command executed each time any user logs in to the Linux system, you place the command in which one of these files? (a) /etc/profile.
9. If a directory contains the file names micron and microscope, and you enter micro and press Tab once, what happens? (a) The shell prints all matching names, micron and microscope.
10. Which of the following is a correctly formed alias for executing the mv command? (d) alias ren=”mv –I”.
11. The command echo $HOME displays (c) the value of the HOME environment variable.
12. Describe the contents of the PATH environment variable. It is a list of the directories that the shell looks in when it is asked to execute a command.
13. When the export command is used, an environment variable (a) is available to other programs running in the same shell where export was executed.
14. Name at least three non-graphical text editors that may be included with a Linux distribution. Vi, pico, and emacs.
15. Knowledge of the vi editor is considered an essential skill because (b) the vi editor is virtually always available to complete system administrations tasks.
16. Suppose you entered the command vi my_file and then press the following keys: itest
17. When you run a program called gather_data, it normally reads lines entered at the keyboard. If you use the command gather_data < input_text to run the program, which of the following occurs? (b) The input that the gather_data program would normally read from the keyboard is taken from the input_text file instead.
18. A pipe is a method of connecting (b) the output channel of one program with the input channel of another program.
19. The command ls | sort causes which of the following to occur? (a) the output of the ls command is sent to the sort command. The results are printed to the screen.
20. Using the lpoptions command, you can (b) associate a set of lpr printing options with a name (called an instance) so that those options can be used more conveniently in the future.
21. Which of these commands displays the current value of the USER environment variable? (a) echo "You are currently logged in as $USER."
22. How is the following text executed on a command line "echo 'This script has detected an error; please check your data.'; date; "Thank you." (a) as two commands, followed by an error message.
23. How is the following text executed on a command line "echo “This script has detected an error\; please check your data.”; date; "Thank you." (a) as two commands, followed by an error message.
24. How is the following text executed on a command line echo This script has detected an error. Please check your data.$’\n’ ‘date’$’ ‘\n’ Thank you. (c) as three lines of text.
25. Does the following text generate a shell error? Does it print the current date? echo 'This script has detected an error. Please check your data.$’\n’’date’$’\n’Thank you.’ (c) It does not cause an error, nor does it print the date.
No comments:
Post a Comment