Linux Ch 3 Quiz
When issuing the ls -F command, what special character indicates a linked file? & * @ =
@ The @ symbol indicates that the file is a linked file.
Select the regular expression metacharacter that matches 0 or more occurrences of the previous character. + * ^ ?
* While using regular expressions, the * permits you to match 0 or more occurrences of the previous character.
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? I a i A
A A capital A will change to insert mode and move to the end of the current line to append new text.
Which of the following key combinations, commonly used in the vi editor command mode, displays current line statistics? $ x Crl+g P
Crl+g Current line statistics include the filename, current line number, total lines in a file, and the percentage (%) of file location.
When using the vi text editor, which of the following keys, when in command mode, will move to the last line in the document? W P G L
G A capital G will move the cursor to the last line in the document.
If enough unique letters of a directory name have been typed, what key can be pressed to activate the BASH shell's completion feature? Esc Ctrl Tab Alt
Tab The Tab key can be used as the "auto complete" feature these days. If there are multiple files or commands that match with the completion feature, the terminal provides the options so the user can select one of the preferences.
In order to move from the /home/joe/test/data to the /home/joe directory, what command should be issued? cd ../.. cd .. /home/joe cd ./..
cd ../.. Correct. The cd ../.. command allows you to move back two previous directories from the current directory. This command will move you to the /home/joe directory.
What commands can help you identify different types of files? (Choose 3) cat stat touch file
file stat
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.) grep "42[3-8]" employees.csv > employees-newhires.csv cat employees.csv | grep "42[3-8]" > employees-newhires.csv cat employees.csv | grep 423,424,425,426,427,428 > employees.csv grep "42[3-8]" < employees.csv > employees-newhires.csv
grep "42[3-8]" employees.csv > employees-newhires.csv cat employees.csv | grep "42[3-8]" > employees-newhires.csv grep "42[3-8]" < employees.csv > employees-newhires.csv
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? grep -E "(John|Bob)" salesemployees.csv grep -E (John|Bob) salesemployees.csv egrep (John|Bob) salesemployees.csv grep (John|Bob) salesemployees.csv
grep -E "(John|Bob)" salesemployees.csv The grep command has a -E option that specifies that it should use extended regular expressions. When used inside parentheses and the pipe symbol, you can search for lines that contain either John or Bob. The pipe symbol is commonly used as an OR operator.
Which of the following commands will not interpret regular expressions, which translates into faster results being returned? (Choose all that apply.) grep egrep grep -F fgrep
grep -F fgrep Correct. The grep -F command is the same as the fgrep command which is used to match fixed strings rather than a pattern using regular expressions. Correct. The fgrep command is the same as the grep -F command which is used to match fixed strings rather than a patter using regular expressions.
Select the command that can be used to provide a long listing for each file in a directory: ls -F ls -l ls -L ls -T
ls -l The ls -l is used to provide a long listing for each file in a certain directory.
What command can be issued to confirm which directory you are in at a command line prompt? pwd whereami ld dir
pwd The pwd (print working directory) command prints the current directory where the user is located at a command line prompt.
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? pwd ls -dir cwd cd -
pwd The pwd command stands for present working directory.
What command can be used to display the last five lines of a text file? end -5 tail -5 stop -5 head -5
tail -5 The tail command by default retrieves the last 10 lines on a file. However, by specifying a number after the dash (-), the user has the capability to customize the number of lines to retrieve. In this example, -5 is used to display the last five lines on the file.