Deck 7: Working With the Bash Shell
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/45
Play
Full screen (f)
Deck 7: Working With the Bash Shell
1
The BASH shell assumes stdout in the absence of a numeric file descriptor. _________________________
True
2
The ENV environment variable represents the location of the BASH run-time configuration file. _________________________
True
3
The file descriptor stdin is represented by the number ____.
A) 0
B) 1
C) 2
D) 3
A) 0
B) 1
C) 2
D) 3
A
4
You can use the sed command to remove unwanted lines of text.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
5
Users can create their own custom variables, called shell variables. _________________________
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
6
To prevent a file from being cleared by the BASH shell and append output to the existing output, you can specify three > metacharacters alongside the file descriptor.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
7
To see a list of the environment variables and their current values on a system, you can use the ____ command.
A) env
B) get
C) set
D) setenv
A) env
B) get
C) set
D) setenv
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
8
The ____ command counts the number of lines, words, and characters in a file.
A) pr
B) nl
C) tr
D) wc
A) pr
B) nl
C) tr
D) wc
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
9
You can redirect a file to the standard input of a command using the ____ metacharacter.
A) >
B) #
C) |
D) <
A) >
B) #
C) |
D) <
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
10
You can send the standard output of one command to another command as standard input using the ____ shell metacharacter.
A) <
B) |
C) >
D) #
A) <
B) |
C) >
D) #
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
11
Given the syntax command && command, the command on the left of the && construct is executed only if the command on the right of the && construct completed successfully.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
12
The file descriptor stderr is represented by the number ____.
A) 0
B) 1
C) 2
D) 3
A) 0
B) 1
C) 2
D) 3
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
13
Most configuration files on Linux systems are delimited using ____ characters.
A) tab
B) colon
C) space
D) semicolon
A) tab
B) colon
C) space
D) semicolon
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
14
You are limited to using one pipe | metacharacter on the command line to pipe information from one command to another command.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
15
The ____ command can be used to replace characters in a file sent via Standard Input.
A) tr
B) rt
C) ts
D) st
A) tr
B) rt
C) ts
D) st
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
16
In a decision construct, you can have an unlimited number of if then statements. _________________________
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
17
The ____ command can be used to extract, manipulate, and format text using pattern-action statements.
A) sed
B) grep
C) awk
D) nl
A) sed
B) grep
C) awk
D) nl
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
18
Any command that can be executed on the command line can also be placed inside any environment file.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
19
You can use the BASH shell to redirect standard output and standard error from the terminal screen to a file on the filesystem using the ____ shell metacharacter followed by the absolute or relative pathname of the file.
A) #
B) <
C) >
D) |
A) #
B) <
C) >
D) |
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
20
Aliases are shortcuts to commands stored in special variables that can be created and viewed using the alias command. _________________________
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
21
A case construct must be ended by ____________________.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
22
To see a list of all exported environment and user-defined variables in the shell, you can use the ____ command.
A) env
B) set
C) setenv
D) getenv
A) env
B) set
C) setenv
D) getenv
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
23
The test statement ____ would be used to determine if A is numerically greater than B.
A) [ A -g B ]
B) [ A -ge B ]
C) [ A -gt B ]
D) [ A +eq B ]
A) [ A -g B ]
B) [ A -ge B ]
C) [ A -gt B ]
D) [ A +eq B ]
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
24
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
25
If you have ____ permission to a shell script, you can execute the shell script like any other executable program on the system.
A) read
B) write and read
C) execute
D) read and execute
A) read
B) write and read
C) execute
D) read and execute
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
26
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Labels representing command input and output.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Labels representing command input and output.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ command could be used to view the contents of the environment variable that represents the BASH shell prompt.
A) ls $PWD
B) echo #PWD
C) echo $PS1
D) ls #PS1
A) ls $PWD
B) echo #PWD
C) echo $PS1
D) ls #PS1
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
28
The ____________________ environment variable contains a list of directories to search for executable programs.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
29
Most commands that are run by the shell are run in a separate ____________________, which is created by the current shell.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
30
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
A filter command that takes information from standard input and sends that information to a file, as well as to standard output.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
A filter command that takes information from standard input and sends that information to a file, as well as to standard output.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
31
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The normal output of a command.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The normal output of a command.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
32
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Constructs that alter the flow of a program based on whether a command in the program completed successfully or based on a decision that the user makes given a question posed by the program.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Constructs that alter the flow of a program based on whether a command in the program completed successfully or based on a decision that the user makes given a question posed by the program.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
33
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
34
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
35
The ____ environment file is always executed immediately after login for all users on the system, and sets most environment variables, such as HOME and PATH.
A) ~/.bash_profile
B) ~/.bash_login
C) /etc/profile
D) ~/.profile
A) ~/.bash_profile
B) ~/.bash_login
C) /etc/profile
D) ~/.profile
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
36
The ____________________ command takes user input from stdin and places it in a variable specified by an argument.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
37
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Any error messages generated by a command.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
Any error messages generated by a command.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
38
Match each term with the correct statement below.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The information that is processed by the command during execution.
a.hashpling
f.decision construct
b.tee
g.shell scripts
c.environment variables
h.stdout
d.stdin
i.file descriptors
e.stderr
The information that is processed by the command during execution.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
39
Any command that can take standard input and transform it into standard output is called a(n) ____________________ command.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ escape sequence represents a form feed.
A) \n
B) \f
C) /f
D) /n
A) \n
B) \f
C) /f
D) /n
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
41
What are shell variables? What are environment and user-defined variables?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
42
What is a decision construct? What is the most common type of decision construct, and what is the syntax for using it?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
43
What are file descriptors? What are the three file descriptors are available to each command that can be manipulated by the BASH shell, and what is the purpose of each?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
44
What are shell scripts? Why and how are they executed?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
45
Describe the while construct. How and why is it used?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck