Linux+ Study Guide Chapter 1: Review Questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

How many commands can you pipe together at once?

Any arbitrary number

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

Echo because the command is implanted internally into bash, although an external version is also available on most systems. The cat, less, tee, sed commands are not implemented to bash, although they can be called through bash external commands

What does the pwd command accomplish?

It prints the name of the working directory.

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?

Retype the command, and be sure you type the filename correctly, letter by letter. Retype the command, but press Tab key after typing a few letters of the long file-name to ensure the file name is entered correctly. Press the Up arrow key, and use bash's editing features to correct the typo.

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

Tail The tail command displays the file 10 lines of a file

How do the > and >> redirection operators differ?

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? $ 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

The > redirection operator sends both standard output in a file

What is the surest way to run a program (say, myprog) that's located in the current working directory?

Type /. followed by the program name: /.myprog

How does man display information by default on most Linux systems?

Using the custom X-based application

You type echo $PROC, and the computer replies Go away. What does this mean?

You, one of your configuration files, or a program you've run has set the $ PROC environment variable to Go Away

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

d[o-u]g The bracket expression within the d[o-u]g regular expression means that any three-character string beginning in d, ending in g, and with the middle character being between o and u will match.

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. greo longlines.txt > longlines2.txt

fmt longlinws.txt > longlines2.txt The fmt command performs the desired task of shortening long lines by inserting carriage returns. It sends the results to standard output , so option B use output redirection to save the results in a new file.

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'

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

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

grep change [ds] world.txt The grep utility is used to find matching text within the file and print those lines. It accepts regular expressions, which means you can place brackets in the two characters that differ in the words for which you are looking.

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

ifconfig > file.txt The > redirection operator store a command's standard output in a file, overwriting the contents of any existing file by the specific name

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 | cut 'dog' > 'mutt'

sed's/dog/mutt/g' animals.txt The sed utility can be used to "stream" text and change one value to another.

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

verbose 2> /dev/null The 2> redirection operator redirects standard error only, leaving standard output unaffected.

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

B, C, D. The n1 command numbers lines, so it does its task without any special operations. The cat command can also number lines via its -b and -n options; -b numbers non blank lines where -n numbers all lines.

What is the effect of the following command? $ pr report.txt | 1pr

The file report.txt is formatted for printing and sent to the 1pr program

In an xterm window launched from your window manager, you type exec gedit. What will happen when you exit from the gedit program?

The xterm window will be closed.


संबंधित स्टडी सेट्स

Chapter 16 electronic health records

View Set

Manifest Destiny Key Terms - Honours US History

View Set

Quizzes 8, 9, 10, 11, 12, 13, 14

View Set

Real Estate Principles: Subdivisions and Other Public Controls

View Set

Superficial Structures: Neck/Thyroid

View Set

GI Peds GI, GU, Musc (CP, Duchenne's)

View Set

Life-Span Human Development (Chapter 7)

View Set

NSG 3100 Exam 3 Test Your Knowledge

View Set

chapter 21: Depression and other mood disorders

View Set