Chapter 7 Questions
1. What does the shell do while a command is executing? What should you do if you do not want to wait for a command to finish before running another command?
A. The shell tries to find an executable program with the same name as the command. When it does, the shell executes the program. When finishing the command put an & ampersand symbol at the end of the command and the command will run in the background. Then a cursor will be displayed immediately to allow the next command to be entered.
3. What is the PID number? Why are these numbers useful when you run processes in the background? Which utility displays the PID numbers of the commands you are running?
A. PID is a process identification number given to each process created. These PID are helpful to allow the child process to run in the background so the parent process can start a new command. The history utility list all the commands you have ran.
4. Assume that the following files are in the working directory.
Give commands for each of the following, using wildcards to express filenames with as few characters as possible.
a. List all files that begin with section.
$ ls section
b. List the section1, section2, section3 files only.
$ ls section(1-3)
c. List intro file only.
$ ls i
d. List the section1, section3, ref1, and ref3 files.
$ ls [l3] 8. Give an example of a command that uses grep. a. With both input and output redirected. $ grep \$Id < *.c > id_list b. With only input redirected. $ grep –I suzi < addresses c. With only output redirected. $ grep -il memo .txt > memoranda_files
e. Within a pipe.
$ file /usr/bin/ * | grep “Again shell script” | sort –r
In which of the preceding is grep used for a filter? Example d uses grep as a filter.
Chapter 9 Exercises Questions
1. Explain the following unpredicted result:
$ whereis date- date: