Chapter 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What does the pwd command accomplish? A. It prints the name of the working directory. B. It changes the current working directory. C. It prints wide displays on narrow paper. D. It parses Web page URLs for display. E. It prints the terminal's width in characters.

A. It prints the name of the working directory.

How do the > and >> redirection operators differ? A. The > operator creates a new file or overwrites an existing one; the >> operator creates a new file or appends to an existing one. B. The > operator creates a new file or overwrites an existing one; the >> operator appends to an existing file or issues an error message if the specified file doesn't exist. C. The > operator redirects standard output; the >> operator redirects standard error. D. The > operator redirects standard output; the >> operator redirects standard input. E. The > operator writes to an existing file but fails if the file doesn't exist; the >> operator writes to an existing file or creates a new one if it doesn't already exist.

A. The > operator creates a new file or overwrites an existing one; the >> operator creates a new file or appends to an existing one.

What is the effect of the following command? $ pr report.txt | lpr A. The file report.txt is formatted for printing and sent to the lpr program. B. The files report.txt and lpr are combined together into one file and sent to standard output. C. Tabs are converted to spaces in report.txt, and the result is saved in lpr. D. The file report.txt is printed, and any error messages are stored in the file lpr. E. None of the above.

A. The file report.txt is formatted for printing and sent to the lpr program.

What is the surest way to run a program (say, myprog) that's located in the current working directory? A. Type ./ followed by the program name: ./myprog. B. Type the program name alone: myprog. C. Type run followed by the program name: run myprog. D. Type /. followed by the program name: /.myprog. E. Type the program name followed by an ampersand (&): myprog &.

A. Type ./ followed by the program name: ./myprog. . refers to the current working directory / is a directory separator

Which of the following commands will print lines from the file world.txt that contain matches to changes and changed? A. grep change[ds] world.txt B. sed change[d-s] world.txt C. od "change'd|s'" world.txt D. cat world.txt changes changed E. find world.txt "change(d|s)"

A. grep change[ds] world.txt

You've received an ASCII text file (longlines.txt) that uses no carriage returns within paragraphs but two carriage returns between paragraphs. The result is that your preferred text editor displays each paragraph as a very long line. How can you reformat this file so that you can more easily edit it (or a copy)? A. sed 's/Ctrl-M/NL/' longlines.txt B. fmt longlines.txt > longlines2.txt C. cat longlines.txt > longlines2.txt D. pr longlines.txt > longlines2.txt E. grep longlines.txt > longlines2.txt

B. fmt longlines.txt > longlines2.txt

You want to run an interactive script, gabby, which produces a lot of output in response to the user's inputs. To facilitate future study of this script, you want to copy its output to a file. How might you do this? A. gabby > gabby-out.txt B. gabby | tee gabby-out.txt C. gabby < gabby-out.txt D. gabby &> gabby-out.txt E. gabby `gabby-out.txt`

B. gabby | tee gabby-out.txt The tee command sends its output both to standard output and to a named file.

Which of the following commands will number the lines in aleph.txt? (Select three.) A. fmt aleph.txt B. nl aleph.txt C. cat -b aleph.txt D. cat -n aleph.txt E. od -nl aleph.txt

B. nl aleph.txt C. cat -b aleph.txt D. cat -n aleph.txt

What is the effect of the following command? $ myprog &> input.txt A. Standard error to myprog is taken from input.txt. B. Standard input to myprog is taken from input.txt. C. Standard output and standard error from myprog are written to input.txt. D. All of the above. E. None of the above.

C. Standard output and standard error from myprog are written to input.txt. The &> operator sends both standard output and standard error to the specified file.

Which of the following regular expressions will match the strings dog, dug, and various other strings but not dig? A. d.g B. d[ou]g C. d[o-u]g D. di*g E. d.ig

C. d[o-u]g

You want to store the standard output of the ifconfig command in a text file (file.txt) for future reference, and you want to wipe out any existing data in the file. You do not want to store standard error in this file. How can you accomplish these goals? A. ifconfig < file.txt B. ifconfig >> file.txt C. ifconfig > file.txt D. ifconfig | file.txt E. ifconfig 2> file.txt

C. ifconfig > file.txt The > redirection operator stores a command's standard output in a file overwriting the file's previous contents.

Which of the following commands will change all occurrences of dog in the file animals .txt to mutt in the screen display? A. sed -s "dog" "mutt" animals.txt B. grep -s "dog||mutt" animals.txt C. sed 's/dog/mutt/g' animals.txt D. cat animals.txt | grep -c "dog" "mutt" E. fmt animals.txt | cut 'dog' > 'mutt'

C. sed 's/dog/mutt/g' animals.txt

What program would you use to display the end of a configuration file? A. uniq B. cut C. tail D. wc E. fmt

C. tail

A text-mode program, verbose, prints a lot of spurious "error" messages to standard error. How might you get rid of those messages while still interacting with the program? A. verbose | quiet B. verbose &> /dev/null C. verbose 2> /dev/null D. verbose > junk.txt E. quiet-mode verbose

C. verbose 2> /dev/null

You have a data file,data.txt, to be processed by a particular program. However, the program cannot handle data seperated by tabs. The data.txt file's data is separated by a tab stop at every eight characters. What command should you use before processing the data file with the program? A. od data.txt > data1.txt B. expand data.txt >> data.txt C. fmt --remove-tabs data.txt D. expand data.txt > data1.txt E. unexpand -t 8 data.txt

D. expand data.txt > data1.txt

You type a command into bash and pass a long filename to it, but after you enter the command, you receive a File not found error message because of a typo in the filename. How might you proceed? A. Retype the command, and be sure you type the filename correctly, letter by letter. B. Retype the command, but press the Tab key after typing a few letters of the long filename to ensure that the filename is entered correctly. C. Press the Up arrow key, and use bash's editing features to correct the typo. D. Any of the above. E. None of the above.

D.Any of the above Options B and C are the most effiecient

How many commands can you pipe together at once? A. 2 B. 3 C. 4 D. 16 E. An arbitrary number

E. An arbitrary number

How does man display information by default on most Linux systems? A. Using a custom X-based application B. Using the Firefox Web browser C. Using the info browser D. Using the Vi editor E. Using the less pager

E. Using the less pager

Which of the following commands is implemented as an internal command in bash? A. cat B. less C. tee D. sed E. echo

E.Echo Cat,less,tee, and sed are external commands

You type echo $PROC, and the computer replies Go away. What does this mean? A. No currently running processes are associated with your shell, so you may log out without terminating them. B. The remote computer PROC isn't accepting connections; you should contact its administrator to correct the problem. C. Your computer is handling too many processes; you must kill some of them to regain control of the computer. D. Your central processing unit (CPU) is defective and must be replaced as soon as possible. E. You, one of your configuration files, or a program you've run has set the $PROC environment variable to Go away.

E.You, one of your configuration files, or a program you've run has set the $PROC environment variable to Go away. Echo command echos what follows to standard output


Kaugnay na mga set ng pag-aaral

This is for English 2 answers lol

View Set

Firearms, Tool Marks, and Explosives

View Set

PSI Real Estate Practice Exam - Michigan (Chapter 1)

View Set

NSG 210 Antitubercular drugs, Cystic Fibrosis drugs - exam 2

View Set