Chapter 1 - Exploring Linux Command-Line Tools Flashcards

1
Q

On Linux systems, which file typically now points to a shell program instead of holding a shell program?

A. /bin/bash
B. /bin/dash
C. /bin/zsh
D. /bin/sh
E. /bin/tcsh
A

D. /bin/sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

To see only the current Linux kernel version, which command should you use?

A. uname
B. echo $BASH_VERSION
C. uname -r
D. uname -a
E. echo $SHELL
A

C. uname -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What will the echo \^New \^Style command display?

A. \^New \^Style
B. New Style
C. Style New
D. ^New ^Style
E. \ew \tyle
A

D. ^New ^Style

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You need to determine if the fortytwo.sh program is in a $PATH directory. Which of the following commands will assist you in this task? (Choose all that apply.)

A. which fortytwo.sh.
B. cat fortytwo.sh
C. echo $PATH
D. fortytwo.sh
E. /usr/bin/fortytwo.sh
A

A. which fortytwo.sh.
C. echo $PATH
D. fortytwo.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

You want to edit the file SpaceOpera.txt and decide to use the vim editor to complete this task. Which of the following are vim modes you might employ? (Choose all that apply.)

A. Insert
B. Change
C. Command
D. Ex
E. Edit
A

A. Insert
C. Command
D. Ex
E. Edit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

You have a lengthy file named FileA.txt. What will the head -15 FileA.txt command do?

A. Display all but the last 15 lines of the file
B. Display all but the first 15 lines of the file
C. Display the first 15 lines of the file
D. Display the last 15 lines of the file
E. Generate an error message

A

C. Display the first 15 lines of the file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

You are trying to peruse a rather large text file. A co-worker suggests you use a pager. Which of the following best describes what your co-worker is recommending?

A. Use a utility that allows you to view the first few lines of the file.
B. Use a utility that allows you to view one text page at time.
C. Use a utility that allows you to search through the file.
D. Use a utility that allows you to filter out text in the file.
E. Use a utility that allows you to view the last few lines of the file.

A

B. Use a utility that allows you to view one text page at time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following does not describe the less utility?

A. It does not read the entire file prior to displaying the file’s first page.
B. You can use the up and down arrow keys to move through the file.
C. You press the spacebar to move forward a page.
D. You can use the Esc+V key combination to move backward a page.
E. You can press the X key to exit from the utility.

A

E. You can press the X key to exit from the utility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The cat -E MyFile.txt command is entered and at the end of every line displayed is a $.
What does this indicate?

A. The text file has been corrupted somehow.
B. The text file records end in the ASCII character NUL.
C. The text file records end in the ASCII character LF.
D. The text file records end in the ASCII character $.
E. The text file records contain a $ at their end.

A

C. The text file records end in the ASCII character LF.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The cut utility often needs delimiters to process text records. Which of the following best describes a delimiter?

A. One or more characters that designate the beginning of a line in a record

B. One or more characters that designate the end of a line in a record

C. One or more characters that designate the end of a text file to a command-line text processing utility

D. A single space or a colon (:) that creates a boundary between different data items in a record

E. One or more characters that create a boundary between different data items in a record

A

E. One or more characters that create a boundary between different data items in a record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following utilities change text within a file? (Choose all that apply.)

A. cut
B. sort
C. vim
D. nano
E. sed
A

C. vim

D. nano

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A Unicode-encoded text file, MyUCode.txt, needs to be perused. Before you decide what utility to use in order to view the file’s contents, you employ the wc command on it. This utility displays 2020 6786 11328 to STDOUT. What of the following is true? (Choose all
that apply.)

A. The file has 2,020 lines in it.
B. The file has 2,020 characters in it.
C. The file has 6,786 words in it.
D. The file has 11,328 characters in it.
E. The file has 11,328 lines in it.
A

A. The file has 2,020 lines in it.

C. The file has 6,786 words in it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The grep utility can employ regular expressions in its PATTERN . Which of the following best describes a regular expression?

A. A series of characters you define for a utility, which uses the characters to match the same characters in text files

B. ASCII characters, such as LF and NUL, that a utility uses to filter text

C. Wildcard characters, such as * and ?, that a utility uses to filter text

D. A pattern template you define for a utility, which uses the pattern to filter text

E. Quotation marks (single or double) used around characters to prevent unexpected
results

A

D. A pattern template you define for a utility, which uses the pattern to filter text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following is a BRE pattern that could be used with the grep command? (Choose all that apply.)

A. Sp?ce
B. "Space, the .*frontier"
C. ^Space
D. (lasting | final)
E. frontier$
A

A. Sp?ce
B. “Space, the .*frontier”
C. ^Space
E. frontier$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

You need to search through a large text file and find any record that contains either Luke or Laura at the record’s beginning. Also, the phrase “Father is” must be located somewhere in the record’s middle. Which of the following is an ERE pattern that could be used with the egrep command to find this record?

A. "Luke$|Laura$.*Father is"
B. "^Luke|^Laura.Father is"
C. "(^Luke|^Laura).Father is"
D. "(Luke$|Laura$).* Father is$"
E. "(^Luke|^Laura).*Father is.* "
A

B. “^Luke|^Laura.Father is”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following best defines a file descriptor?

A. An environment variable, such as $PS1
B. A number that represents a process’s open files
C. Another term for the file’s name
D. A six character name that represents standard output
E. A symbol that indicates the file’s classification

A

C. Another term for the file’s name

17
Q

A file data.txt needs to be sorted numerically and its output saved to a new file newdata.txt. Which of the following commands can accomplish this task? (Choose all that apply.)

A. sort -n -o newdata.txt data.txt
B. sort -n data.txt > newdata.txt
C. sort -n -o data.txt newdata.txt
D. sort -o newdata.txt data.txt
E. sort data.txt > newdata.txt
A

A. sort -n -o newdata.txt data.txt

B. sort -n data.txt > newdata.txt

18
Q

By default, STDOUT goes to what item?

A. /dev/ttyn , where n is a number
B. /dev/null
C. >
D. /dev/tty
E. pwd
A

D. /dev/tty

19
Q

Which of the following commands will display the file SpaceOpera.txt to output as well as a copy of it to the file SciFi.txt?

A. cat SpaceOpera.txt | tee SciFi.txt
B. cat SpaceOpera.txt > SciFi.txt
C. cat SpaceOpera.txt 2> SciFi.txt
D. cat SpaceOpera.txt SciFi.txt
E. cat SpaceOpera.txt &> SciFi.txt
A

A. cat SpaceOpera.txt | tee SciFi.txt

20
Q

Which of the following commands will put any generated error messages into the black hole?

A. sort SpaceOpera.txt 2> BlackHole
B. sort SpaceOpera.txt &> BlackHole
C. sort SpaceOpera.txt > BlackHole
D. sort SpaceOpera.txt 2> /dev/null
E. sort SpaceOpera.txt > /dev/null
A

D. sort SpaceOpera.txt 2> /dev/null