Chapter3
Select the regular expression metacharacter that matches 0 or more occurrences of the previous character. a. ^ b. * c. + d. ?
b. *
S elect the command that can be used to provide a long listing for each file in a directory: a. ls -L b. ls -I c. ls -T d. ls -F
. ls -I
At the vi command mode prompt, what key combination will force a quit from the vi editor without saving changes? a. :q! b. :! c. :q d. :exit
a. :q!
Which of the following commands will not interpret regular expressions, which translates into faster results being returned? (Choose all that apply.) a. fgrep b. egrep c. grep -F d. grep
a. fgrep c. grep -F
What command can be issued to confirm which directory you are in at a command line prompt? a. dir b. pwd c. ld d. whereami
b. pwd
W hich of the following key combinations, commonly used in the vi editor command mode, displays current line statistics? a. P b. $ c. x d. Crl+g
d. Crl+g
What command can be used to display the last five lines of a text file? a. tail -5 b. end -5 c. head -5 d. stop -5
a. tail -5
Chase is trying to extract records for employees 423 through 428 out of a comma separated values file and store them in another one. Which of the following commands would accomplish this? (Choose all that apply.) a. grep "42[3-8]" < employees.csv > employees-newhires.csv b. grep "42[3-8]" employees.csv > employees-newhires.csv c. cat employees.csv | grep 423,424,425,426,427,428 > employees.csv d. cat employees.csv | grep "42[3-8]" > employees-newhires.csv
a. grep "42[3-8]" < employees.csv > employees-newhires.csv b. grep "42[3-8]" employees.csv > employees-newhires.csv d. cat employees.csv | grep "42[3-8]" > employees-newhires.csv
In order to move from the /home/joe/test/data to the /home/joe directory, what command should be issued? a. cd .. b. cd ../.. c. cd ./.. d. /home/joe
b. cd ../..
When issuing the ls -F command, what special character indicates a linked file? a. = b. & c. @ d. *
c. @
When using the vi text editor, which of the following keys, when in command mode, will change to insert mode and place the cursor at the end of the current line? a. I b. a c. A d. i
c. A
When using the vi text editor, which of the following keys, when in command mode, will move to the last line in the document? a. P b. L c. G d. W
c. G
Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out to the terminal. Which of the following commands could Garrett use to perform this search? a. egrep (John|Bob) salesemployees.csv b. grep (John|Bob) salesemployees.csv c. grep -E "(John|Bob)" salesemployees.csv d. grep -E (John|Bob) salesemployees.csv
c. grep -E "(John|Bob)" salesemployees.csv
Mike has changed directory into one subdirectory after the next and has lost track of where he's at in the directory tree. Which of the following commands can he use to tell him the full path to the current subdirectory he is in? a. cd - b. cwd c. pwd d. ls -dir
c. pwd
T o display a text file in reverse order, what command should be used? a. cat b. tee c. tac d. sed
c. tac
What command is most effective at identifying different types of files? a. ll b. ls -l c. file d. stat
c. file
If enough unique letters of a directory name have been typed, what key can be pressed to activate the BASH shell's completion feature? a. Ctrl b. Alt c. Esc d. Tab
d. Tab
Kate wants to compare two text files to identify what might have been changed from one version to another. Which of the following commands can she use to do this? a. version --compare document1.txt document2.txt b. match document1.txt document2.txt c. compare document1.txt document2.txt d. diff document1.txt document2.txt
d. diff document1.txt document2.txt