Sunday, February 15, 2009

Chapter 3 Review Questions

1.) The default shell used by Linux is:

The Bourne Again shell (bash)

2.) When logged in as root, the shell prompt normally changes to display:

#

3.) The main function of a shell is to:

Start programs

4.) Name four different shells and briefly describe the differences between them.

1.) bash: This is the default shell of Linux
2.) csh: Uses a more complex syntax for programming the shell
3.) ksh: Has the features of csh while having the syntax of bash
4.) zsh: Combines ksh interactive features with csh programming syntax

5.) Tab completion is useful when you need to:

Enter long file names or directory names at the shell prompt.

6.) The history command is used to:

Display a list of previously entered commands.

7.) Entering the command !fr would do the following in the bash shell:

Reexecute the most recently executed command that began with "fr".

8.) To have a command executed each time any user logs in to the Linux system, you place the command in which of these files:

/etc/bashrc

9.) If a directory contains the file names micron and microscope, and you enter micro and pres Tab once, what happens?

The shell beeps

10.) Which of the following is a correctly formed alias for executing the mv command:

alias ren="mv -i"

11.) The command echo $HOME displays:

The word HOME

12.) Describe the contents of the PATH environment variable.

It is a list of the different "paths" that will be searched whenever a command is entered.

13.) When the export command is used, an environment variable:

Is available to other programs running in the same shell where export was executed.

14.) Name at least three nongraphical text editors that may be included with a Linux distribution.

1.) vi
2.) emacs
3.) pico
4.) joe

15.) Knowledge of the vi editor is considered an essential skill because:

The vi editor is virtually always available to complete system administrator tasks.

16.) Suppose you enter the command vi my_file and then enter the following keys: itestyyp:wq
Describe the results

It copies the word "test" into the buffer and then places the word "test" on the next line below. Then it saves the file as you exit the vi editor.

17.) When you run a program called gather_data, it normally reads lines entered at the keyboard. If you use the command gather_data <> to run the program which of the following occurs:

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:

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?

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:

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?

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."

As two commands followed by an error message

23.) How is the following text executed on a command line?

How is the following text executed on a command line?
echo "This script has detected an error\; please check your data."; date; "Thank you."

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.'

As three lines of text

25.) Does the follow text generate a shell error? Does it print the date?
echo 'This script has detected an error. Please check your data.$'\n'`date`$'\n'Thank you'

No it does not generate a shell error. It does not print the date.

No comments: