Q1) What does the shell ordinarily 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?
A1) The shell goes to “sleep” until the command has been processed. You can run a program in the background, which will allow you to run more than one at a time.
Q3) What is a PID number? Why are these numbers useful when you run process in the background? Which utility displays the PID numbers of the commands you are running?
A3) process identification (PID) number—a larger number assigned by the operating sys- tem. Each of these numbers identifies the command running in the background. It’s useful to know what jobs the program has completed and which ones are still running. The utility to use to run more than one command is “&”.
Q4) Assume that the following files are in the working directory: intro notesb ref2 section1 section3 section4b notesa ref1 ref3 section2 section4a sentrev
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.
b. List the section1, section2, and section3 files only.
c. List the intro file only.
d. List the section1, section3, ref1, and ref3 files.
A4) a – $ echo section* B - $ echo section(1,2,3)* C – 4 echo *intro
Q8) Give an example of a command that uses grep
a. With both input and output redirected.
b. With only input redirected.
c. With only output redirected.
d. Within a pipe.
In which of the preceding cases is grep used as a filter?
A8) a - $ grep \$Id<*.c>id_list
B - $ grep –I mike <address
C - $ grep –il report *.txt >report_files
D - $ file /usr/bin/* | grep “shell script” | sort –r
“d” uses grep as a filter
CHAPTER 9
Q1 – Explain the following unexpected result
A - $ whereis date
Date: /bin/date…
B - $ echo $PATH
.:/usr/local/bin:/usr/bin:/bin
C - $ cat > date
Echo the format