It 250 Homework 4

Only available on StudyMode
  • Topic: File system, Working directory, Windows PowerShell
  • Pages : 4 (769 words )
  • Download(s) : 1875
  • Published : April 25, 2012
Open Document
Text Preview
1. 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? Answer: The shell waits for the command to finish executing. You can send the command to the background by using "&". 2. What is a 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? Answer: A PID number is an identification number assigned to a command running in the background, which can be used to differentiate between commands. The PS (process status) utility. 3. Assume that the following files are in the working directory: $ ls

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.
Answer: $ ls section*
b. List the section1, section2, and section3 files only.
Answer: $ ls section[1-3]
c. List the intro file only.
Answer: $ ls i*
d. List the section1, section3, ref1, and ref3 files.
Answer: $ ls *[13]

4. Give a command to
A. Redirect the standard output from a sort command into a file named phone_list. Assume that the input file is named numbers. Answer: $ sort numbers > phone_list
B. Translate all occurrences of the characters [ and { to the character (, and all occurrences of the characters ] and } to the character ) in the file permdemos.c.
Answer: $ cat permdemos.c | tr '[{}]' '(())'
C. Create a file named book that contains the contents of two other files: part1 and part2.
Answer: $ cat part[12] > book
5. In experimenting with shell variable, Alex accidentally deletes his PATH variable. He decides that he does not need the path variable. Discuss some of the problems he may soon encounter and explain the reasons for these problems. How could he easily return PATH to its...
tracking img