Module 3 Lab/Test Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

If you have more lines in the file, then you can jump a specific number of lines by entering ______ along with _____. $, j *, j #, j @, j

#, j

To navigate to the end of a line, press ______. $ @ ! #

$

If a user's current directory is /home/mary/project1, which command could she use to move to the etc directory directly under the root?

cd /etc

If you need to visit the Documents directory in the home directory of the user Administrator, what would be the correct command? cd Documents/ cd /home/../Documents cd /home/administrator/Documents cd ../Documents

cd /home/administrator/Documents

What is the relative path to get into the Documents directory? cd Documents/ cd /home/administrator/Documents cd ../Documents cd /home/../Documents

cd Documents/

Which of the following are examples of a relative path? [Choose all that apply.] cd Documents/ cd /var/cache cd ../backups cd /etc cd ..

cd Documents/ cd ../backups cd ..

Which command will take you back to the home directory? cd .. cd.. cd \ cd /

cd \

Which of the following are examples of an absolute path? [Choose all that apply.] cd /etc cd /var/cache cd .. cd ../backups

cd var/cache cd /etc

The vi editor can function in which two of the following modes? (Choose both that apply.) text command input interactive insert

command insert

Which command would a user type on the command line to find out the current directory in the directory tree? pd cd where pwd

pwd

When working with the vi editor, other than pressing "I", pressing which another key will invoke the insert mode? -a -k -m -l

-a

Using the grep command, you want to count the number of lines in which the searched text appears. Which parameter should you use? -n -l -a -q -c -d

-c

Which parameter of the grep command displays the line number of the line that contains the searched text? -d -q -n -l -a

-n

Which of the following is an absolute pathname? (Choose all that apply.) Home/resume C:\myfolder\resume resume /home/resume C:home/resume

/home/resume

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. I d. A

A

The tac command _________.

A Linux command that displays a file on the screen, beginning with the last line of the file and ending with the first line of the file.

Which of the following special characters cannot be used with the grep command unless you use them as metacharacters? [Choose all that apply.] ( + | { ?

All of them ( + | { ?

The less command offers less functionality than the more command. True or False?

False

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. G b. L c. P d. W

G

After typing the ls -a command, you notice a file whose filename begins with a dot ( . ). What does this mean?

It is a hidden file.

After typing the ls -F command, you notice a filename that ends with an * (asterisk) character. What does this mean?

It is an executable file.

To navigate to the end of a word, press ____ and you will jump to the end of the word. t a f e

e

How can a user switch from insert mode to command mode when using the vi editor?

Press the Esc key.

How can you specify a text pattern that must be at the beginning of a line of text using a regular expression?

Precede the string with a ^.

What will typing q! at the : prompt in command mode do when using the vi editor?

Quit without saving any changes.

A directory is a type of file. True or False?

True

Linux has only one root directory per directory tree. True or False?

True

Using wildcard metacharacters, how can you indicate a character that is not an a or b or c or d?

[!a-d]

A user typed in the command pwd and saw the output: /home/jim/sales/pending. How could that user navigate to the /home/jim directory?

cd ../..

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. match document1.txt document2.txt b. version --compare document1.txt document2.txt c. compare document1.txt document2.txt d. diff document1.txt document2.txt

diff document1.txt document2.txt

To count the number of lines in /etc/yum.conf that either start with 1 or end with 01, which of the following command should be used? egrep -c '1|01$' /etc/yum.conf egrep -c '^1|01$' /etc/yum.conf egrep -c '/^1|01$/' /etc/yum.conf egrep -c -^1|01$ /etc/yum.conf

egrep -c '^1|01$' /etc/yum.conf

What will the following wildcard regular expression return: file[a-c]?

filea, fileb, filec

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. cat employees.csv | grep 423,424,425,426,427,428 > employees.csv b. cat employees.csv | grep "42[3-8]" > employees-newhires.csv c. grep "42[3-8]" employees.csv > employees-newhires.csv d. 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

Jo has received a text file which contains multiple instances of his name spelled correctly as well as multiple instances spelled as Joe. Which of the following commands would search a text file for any occurrences of either spelling and display them out to the terminal? (Choose three.) a. grep "Joe?" document1.txt b. grep -E "Joe?" document1.txt c. grep "Joe*" document1.txt d. grep -E "Joe*" document1.txt

grep "Joe*" document1.txt grep -E "Joe*" document1.txt grep -E "Joe?" document1.txt

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. grep -E "(John|Bob)" salesemployees.csv b. grep (John|Bob) salesemployees.csv c. grep -E (John|Bob) salesemployees.csv d. egrep (John|Bob) salesemployees.csv

grep -E "(John|Bob)" salesemployees.csv

Which of the following commands will not interpret regular expressions, which translates into faster results being returned? (Choose all that apply.) a. grep b. grep -F c. egrep d. fgrep

grep -F fgrep

In the command mode, pressing which letter would move one character to the left? e h a b k

h

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. pwd c. cwd d. ls -dir

pwd

A special device file is used to ___________. enable proprietary custom-built devices to work with Linux represent hardware devices such as hard disk drives and ports keep a list of device settings specific to each individual user do nothing in Linux

represent hardware devices such as hard disk drives and ports

If "resume" is the name of a file in the home directory off the root of the filesystem and your present working directory is home, what is the relative name for the file named resume?

resume

To delete all the blank lines at the end of the file, which of the following command should be used? sed '/^ / d' yumtest.conf grep '/^ / d' yumtest.conf fgrep '/^ / d' yumtest.conf vi '/^ / d' yumtest.conf

sed '/^ / d' yumtest.conf

Which command searches for and displays any text contents of a binary file?

strings

A user types the command head /poems/mary. What will be displayed on the terminal screen?

the first 10 lines of the file mary


Ensembles d'études connexes

Macroeconomics 202 Midterm 2 Chapter 12

View Set

Money and Banking Exam 2 HW Ch 8&9, 10, 12

View Set

Expert - Consent & Preference Management

View Set

Section 4: Continuous Probability Distributions

View Set

"Rikki-tikki-tavi" by Rudyard Kipling

View Set

BIO-CHAP 6&7 Unit 4 (CR & Photosynthesis)

View Set

Operations Management Final Exam

View Set