ITN 170 CHAPTER 3 QUIZ

Ace your homework & exams now with Quizwiz!

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

$

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

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? a. cd .. b. cd /home/mary/etc c. cd etc d. cd /etc e. cd \etc

cd /etc

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

cd /var/cache cd /etc

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

cd Documents/

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

cd \

Select the regular expression metacharacter that matches 0 or more occurrences of the previous character. * ? + ^

*

When using the vi text editor, which of the following keys, when in command mode, will move to the last line in the document? G L P W

G

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

-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 -q -d -a -c

-c

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

-n

After typing the ls -a command, you notice a file whose filename begins with a dot ( . ). What does this mean? a. It is a binary file. b. It is a system file. c. It is a file in the current directory. d. It is a hidden file.

It is a hidden file

Select the command that can be used to provide a long listing for each file in a directory: ls -T ls -L ls -F ls -I

ls -I

When issuing the ls -F command, what special character indicates a linked file? @ * & =

@

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

he vi editor can function in which two of the following modes? (Choose both that apply.) a. text b. command c. input d. interactive e. insert

Command & Insert

Which of the following key combinations, commonly used in the vi editor command mode, displays current line statistics? $ x Crl+g P

Ctrl+g

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

False

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

pwd

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

What command is most effective at identifying different types of files? stat ls -l ll file

file

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

/home/resume

At the vi command mode prompt, what key combination will force a quit from the vi editor without saving changes? :q :q! :exit :!

:q!

After typing the ls -F command, you notice a filename that ends with an * (asterisk) character. What does this mean? a. It is a hidden file. b. It is a linked file. c. It is a special device file. d. It is an executable file.

It is an executable file

How can you specify a text pattern that must be at the beginning of a line of text using a regular expression? a. Precede the string with a /. b. Follow the string with a \. c. Precede the string with a $. d. Precede the string with a ^.

Precede the string with a ^.

How can a user switch from insert mode to command mode when using the vi editor? a. Press the Ctrl+Alt+Del keys simultaneously. b. Press the Del key. c. Type a : character. d. Press the Esc key.

Press the Esc key.

Which command searches for and displays any text contents of a binary file? a. text b. strings c. od d. less

Strings

If enough unique letters of a directory name have been typed, what key can be pressed to activate the BASH shell's completion feature? Alt Tab Ctrl Esc

Tab

A directory is a type of file. True or False? a. True b. 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. [^abcd] b. not [a-d] c. [!a-d] d. !a-d

[!a-d]

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

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? a. cd .. b. cd /jim c. cd ../.. d. cd ./

cd ../..

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

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

cd ../backups cd .. cd Documents/

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 Documents/ cd /home/../Documents cd /home/administrator/Documents

cd /home/administrator/Documents

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? match document1.txt document2.txtversion --compare document1.txt document2.txtcompare document1.txt document2.txtdiff document1.txt document2.txt

diff document1.txt document2.txt

The tac command _________. a. is not a valid Linux command. b. displays the contents of hidden files . c. displays the contents of a file in reverse order last word on the line first and first word on the line last. d. displays the contents of a file in reverse order last line first and first line last.

displays the contents of a file in reverse order last line first and first line last.

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

e

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]? a. filea-c b. filea, filec c. filea, fileb, filec d. fileab

filea, fileb, filec

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 (John|Bob) salesemployees.csv grep -E (John|Bob) salesemployees.csve grep (John|Bob) salesemployees.csv

grep -E "(John|Bob)" salesemployees.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.) grep "Joe?" document1.txt grep -E "Joe?" document1.txt grep "Joe*" document1.txt grep -E "Joe*" document1.txt

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

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

grep -F fgrep

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

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? cd - pwd cwd ls -dir

pwd

What command can be issued to confirm which directory you are in at a command line prompt? dir pwd whereami ld

pwd

What will typing q! at the : prompt in command mode do when using the vi editor? a. quit as no changes were made b. quit after saving any changes c. nothing because the ! is a metacharacter d. quit without saving any changes

quit without saving any changes

A special device file is used to ___________. a. enable proprietary custom-built devices to work with Linux b. represent hardware devices such as hard disk drives and ports c. keep a list of device settings specific to each individual user d. 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? a. /home/resume b. /resume c. resume d. \home\resume

resume

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

sed '/^ / d' yumtest.conf

To display a text file in reverse order, what command should be used? cat tac tee sed

tac

What command can be used to display the last five lines of a text file? end -5 head -5 stop -5 tail -5

tail -5

A user types the command head /poems/mary. What will be displayed on the terminal screen? a. the first line of the file mary b. the header for the file mary c. the first 20 lines of the file mary d. the last 10 lines of the file mary e. the first 10 lines of the file mary

the first 10 lines of the file mary


Related study sets

Chapter 13 - Central Nervous System Stimulants and Related Drugs

View Set

Life Insurance Basics L1 (ch. 4)

View Set

Vistas Supersite (Ed 5.) Chapter 1 Vocab Spanish 1100 Mizzou

View Set