Deck 8: Working With the Bash Shell

Full screen (f)
exit full mode
Question
Any command that can be executed on the command line can also be placed inside any environment file.
Use Space or
up arrow
down arrow
to flip the card.
Question
The ____ command can be used to replace characters in a file sent via Standard Input.

A)tr
B)rt
C)ts
D)st
Question
You can redirect a file to the Standard Input of a command using the ____ metacharacter.

A)>
B)#
C)|
D)<
Question
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.
Question
You are limited to using one pipe | metacharacter on the command line to pipe information from one command to another command.
Question
You can use the sed command to remove unwanted lines of text.
Question
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
Question
You can send the Standard Output of one command to another command as Standard Input using the ____ shell metacharacter.

A)<
B)|
C)>
D)#
Question
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
Question
The ____ command counts the number of lines, words, and characters in a file.

A)pr
B)nl
C)tr
D)wc
Question
stderr is represented by the number ____.

A)0
B)1
C)2
D)3
Question
The ____ command can be used to extract, manipulate, and format text using pattern-action statements.

A)sed
B)grep
C)awk
D)nl
Question
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)|
Question
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.
Question
Most configuration files on Linux systems are delimited using ____ characters.

A)tab
B)colon
C)space
D)semicolon
Question
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
Question
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
Question
The ____ escape sequence represents a form feed.

A)\n
B)\f
C)/f
D)/n
Question
stdin is represented by the number ____.

A)0
B)1
C)2
D)3
Question
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
Question
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?
Question
What are shell variables? What are environment and user-defined variables?
Question
Match between columns
The normal output of a command.
file descriptors
The normal output of a command.
stderr
The normal output of a command.
environment variables
The normal output of a command.
shell scripts
The normal output of a command.
hashpling
The normal output of a command.
stdin
The normal output of a command.
decision construct
The normal output of a command.
stdout
The normal output of a command.
tee
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
file descriptors
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stderr
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
environment variables
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
shell scripts
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
hashpling
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stdin
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
decision construct
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stdout
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
tee
The information that is processed by the command during execution.
file descriptors
The information that is processed by the command during execution.
stderr
The information that is processed by the command during execution.
environment variables
The information that is processed by the command during execution.
shell scripts
The information that is processed by the command during execution.
hashpling
The information that is processed by the command during execution.
stdin
The information that is processed by the command during execution.
decision construct
The information that is processed by the command during execution.
stdout
The information that is processed by the command during execution.
tee
Labels representing command input and output.
file descriptors
Labels representing command input and output.
stderr
Labels representing command input and output.
environment variables
Labels representing command input and output.
shell scripts
Labels representing command input and output.
hashpling
Labels representing command input and output.
stdin
Labels representing command input and output.
decision construct
Labels representing command input and output.
stdout
Labels representing command input and output.
tee
Any error messages generated by a command.
file descriptors
Any error messages generated by a command.
stderr
Any error messages generated by a command.
environment variables
Any error messages generated by a command.
shell scripts
Any error messages generated by a command.
hashpling
Any error messages generated by a command.
stdin
Any error messages generated by a command.
decision construct
Any error messages generated by a command.
stdout
Any error messages generated by a command.
tee
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
file descriptors
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stderr
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
environment variables
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
shell scripts
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
hashpling
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stdin
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
decision construct
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stdout
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
tee
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
file descriptors
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stderr
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
environment variables
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
shell scripts
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
hashpling
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stdin
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
decision construct
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stdout
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
tee
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
file descriptors
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stderr
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
environment variables
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
shell scripts
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
hashpling
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stdin
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
decision construct
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stdout
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
tee
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.
file descriptors
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.
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.
environment variables
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.
shell scripts
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.
hashpling
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.
stdin
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.
decision construct
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.
stdout
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.
tee
Question
Describe the && and || constructs. How and why are they used?
Question
Any command that can take from Standard Input and give to Standard Output is called a(n)____________________ command.
Question
Most commands that are run by the shell are run in a separate ____________________, which is created by the current shell.
Question
What is a decision construct? What is the most common type of decision construct, and what is the syntax for using it?
Question
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 ]
Question
The ____________________ environment variable contains a list of directories to search for executable programs.
Question
A case construct must be ended by ____________________.
Question
What are shell scripts? Why and how are they executed?
Question
The ____________________ command takes user input from Standard Input and places it in a variable specified by an argument.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/32
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Working With the Bash Shell
1
Any command that can be executed on the command line can also be placed inside any environment file.
True
2
The ____ command can be used to replace characters in a file sent via Standard Input.

A)tr
B)rt
C)ts
D)st
A
3
You can redirect a file to the Standard Input of a command using the ____ metacharacter.

A)>
B)#
C)|
D)<
D
4
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 32 flashcards in this deck.
Unlock Deck
k this deck
5
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 32 flashcards in this deck.
Unlock Deck
k this deck
6
You can use the sed command to remove unwanted lines of text.
Unlock Deck
Unlock for access to all 32 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
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
8
You can send the Standard Output of one command to another command as Standard Input using the ____ shell metacharacter.

A)<
B)|
C)>
D)#
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
9
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
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
10
The ____ command counts the number of lines, words, and characters in a file.

A)pr
B)nl
C)tr
D)wc
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
11
stderr is represented by the number ____.

A)0
B)1
C)2
D)3
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
12
The ____ command can be used to extract, manipulate, and format text using pattern-action statements.

A)sed
B)grep
C)awk
D)nl
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
13
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)|
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
14
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 32 flashcards in this deck.
Unlock Deck
k this deck
15
Most configuration files on Linux systems are delimited using ____ characters.

A)tab
B)colon
C)space
D)semicolon
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
16
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
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
17
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
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
18
The ____ escape sequence represents a form feed.

A)\n
B)\f
C)/f
D)/n
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
19
stdin is represented by the number ____.

A)0
B)1
C)2
D)3
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
20
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
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
21
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 32 flashcards in this deck.
Unlock Deck
k this deck
22
What are shell variables? What are environment and user-defined variables?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
23
Match between columns
The normal output of a command.
file descriptors
The normal output of a command.
stderr
The normal output of a command.
environment variables
The normal output of a command.
shell scripts
The normal output of a command.
hashpling
The normal output of a command.
stdin
The normal output of a command.
decision construct
The normal output of a command.
stdout
The normal output of a command.
tee
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
file descriptors
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stderr
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
environment variables
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
shell scripts
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
hashpling
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stdin
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
decision construct
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
stdout
Files that are typically used to create custom programs that perform administrative tasks on Linux systems.
tee
The information that is processed by the command during execution.
file descriptors
The information that is processed by the command during execution.
stderr
The information that is processed by the command during execution.
environment variables
The information that is processed by the command during execution.
shell scripts
The information that is processed by the command during execution.
hashpling
The information that is processed by the command during execution.
stdin
The information that is processed by the command during execution.
decision construct
The information that is processed by the command during execution.
stdout
The information that is processed by the command during execution.
tee
Labels representing command input and output.
file descriptors
Labels representing command input and output.
stderr
Labels representing command input and output.
environment variables
Labels representing command input and output.
shell scripts
Labels representing command input and output.
hashpling
Labels representing command input and output.
stdin
Labels representing command input and output.
decision construct
Labels representing command input and output.
stdout
Labels representing command input and output.
tee
Any error messages generated by a command.
file descriptors
Any error messages generated by a command.
stderr
Any error messages generated by a command.
environment variables
Any error messages generated by a command.
shell scripts
Any error messages generated by a command.
hashpling
Any error messages generated by a command.
stdin
Any error messages generated by a command.
decision construct
Any error messages generated by a command.
stdout
Any error messages generated by a command.
tee
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
file descriptors
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stderr
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
environment variables
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
shell scripts
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
hashpling
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stdin
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
decision construct
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
stdout
The first line in a shell script, which specifies the pathname to the shell that interprets the contents of the shell script.
tee
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
file descriptors
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stderr
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
environment variables
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
shell scripts
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
hashpling
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stdin
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
decision construct
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
stdout
A filter command that takes information from Standard Input and sends that information to a file, as well as to Standard Output.
tee
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
file descriptors
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stderr
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
environment variables
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
shell scripts
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
hashpling
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stdin
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
decision construct
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
stdout
Shell variables that are typically set by the system and contain information that the system and programs access regularly.
tee
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.
file descriptors
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.
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.
environment variables
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.
shell scripts
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.
hashpling
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.
stdin
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.
decision construct
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.
stdout
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.
tee
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
24
Describe the && and || constructs. How and why are they used?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
25
Any command that can take from Standard Input and give to Standard Output is called a(n)____________________ command.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
26
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 32 flashcards in this deck.
Unlock Deck
k this deck
27
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 32 flashcards in this deck.
Unlock Deck
k this deck
28
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 ]
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
29
The ____________________ environment variable contains a list of directories to search for executable programs.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
30
A case construct must be ended by ____________________.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
31
What are shell scripts? Why and how are they executed?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
32
The ____________________ command takes user input from Standard Input and places it in a variable specified by an argument.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 32 flashcards in this deck.