Deck 7: Working With the Bash Shell

ملء الشاشة (f)
exit full mode
سؤال
You can use the sed command to remove unwanted lines of text.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
What permissions are required to execute a shell script in a manner similar to any other executable program on the system?

A) read
B) write and read
C) execute
D) read and execute
سؤال
The ability to extract, manipulate, and format text using pattern action statements belongs to which command below?

A) sed
B) grep
C) awk
D) nl
سؤال
What number represents the stdin file descriptor?

A) 0
B) 1
C) 2
D) 3
سؤال
What character is used to delimit most Linux configuration files?

A) tab
B) colon
C) space
D) semicolon
سؤال
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.
سؤال
You are limited to using one pipe | metacharacter on the command line to pipe information from one command to another command.
سؤال
Select the escape sequence that is used for a form feed:

A) \n
B) \f
C) /f
D) /n
سؤال
A list of all exported environment and user-defined variables in a shell can be viewed with what command below?

A) env
B) set
C) setenv
D) getenv
سؤال
The standard output and standard error from a terminal screen within the BASH shell can be redirected to a file on the filesystem using what shell metacharacter, followed by the absolute or relative pathname of the file?

A) #
B) <
C) >
D) |
سؤال
Select the metacharacter that can be used to send the standard output of one command to another command as standard input:

A) <
B) |
C) >
D) #
سؤال
What number represents the stderr file descriptor?

A) 0
B) 1
C) 2
D) 3
سؤال
The default BASH shell prompt is set by an environment variable. What command can be used to view this variable?

A) ls $PWD
B) echo #PWD
C) echo $PS1
D) ls #PS1
سؤال
The environment variables that are set by default and their current values can be viewed with what command?

A) env
B) get
C) set
D) setenv
سؤال
Which command can be used to count the number lines, words, and characters in a file?

A) pr
B) nl
C) tr
D) wc
سؤال
In order to redirect a file to the standard input of a command, what metacharacter should be used?

A) >
B) #
C) |
D) <
سؤال
What 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
سؤال
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.
سؤال
What command can be used to replace characters in a file sent via Standard Input?

A) tr
B) rt
C) ts
D) st
سؤال
Any command that can be executed on the command line can also be placed inside any environment file.
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The first line in a shell script, which defines the shell that will be used to interpret the commands in the script file.
سؤال
The ____________________ environment variable contains a list of directories to search for executable programs.
سؤال
Explain the while construct, and demonstrate how it can be used.
سؤال
Select the escape sequence that starts a new line when used with echo:

A) ​\\
B) ​\a
C) ​\n
D) ​\r
سؤال
Detail shell scripts and explain how they are used and executed.
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A special construct used in a shell script to alter the flow of the program based on the outcome of a command or contents of a variable. Common decision constructs include if, case, &&, and ||.
سؤال
Select the test statement that can 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 ]
سؤال
Provide information on decision constructs, and explain how to use the most common type of decision construct.
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A special construct used in a shell script to execute commands repetitively. Common decision constructs include for and while.
سؤال
The ____________________ command takes user input from stdin and places it in a variable specified by an argument.
سؤال
Describe what file descriptors are, and then list three that can be used within the BASH shell, and discuss how they can be used.
سؤال
Describe shell variables, and explain environment and user-defined variables.
سؤال
Most commands that are run by the shell are run in a separate ____________________, which is created by the current shell.
سؤال
A case construct must be ended by ____________________.
سؤال
What character combination at the start of a shell script are referred to as a hashpling, and allow for the specification of the shell that interprets the contents of the script?

A) ​@!
B) ​#!
C) ​//
D) ​->
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents information input to a command during execution.
سؤال
​What construct is intended for use in processing a list of objects, such as files, directories, users, printers, and so on?

A) ​for
B) ​while
C) ​case
D) ​switch
سؤال
​What operator below is known as the NOT operator?

A) ​-o
B) ​-a
C) ​!
D) ​%
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A variable that is altered by loop constructs to ensure that commands are not executed indefinitely.
سؤال
Any command that can take standard input and transform it into standard output is called a(n) ____________________ command.
سؤال
In an if construct, what statements are optional?​

A) ​fi
B) ​elif
C) ​else
D) ​then
سؤال
Select the two escape sequences that represent a horizontal tab and a vertical tab, respectively:​

A) ​\V
B) ​\t
C) ​\v
D) ​\b
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The numeric labels used to define command input and command output.
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The process of changing the default locations of Standard Input, Standard Output, and Standard Error.
سؤال
​What two BASH environment variables represent the current working directory, and the absolute pathname of the current shell, respectively?

A) ​PWD
B) ​CWD
C) ​PATH
D) ​SHELL
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The variables that store information commonly accessed by the system or programs executing on the system; together, these variables form the user environment.
سؤال
Select the two commands below that will provide the number of lines in a file, and the number of characters in a file, respectively:​

A) ​count -c
B) ​pr -d
C) ​wc -l
D) ​wc -c
سؤال
What two files below are the first two BASH environment files to be executed?​

A) ​/etc/profile
B) ​/etc/bashrc
C) ​˜/.bashrc
D) ​˜/.bash_profile
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents any error messages generated by a command.
سؤال
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents the desired output from a command.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Working With the Bash Shell
1
You can use the sed command to remove unwanted lines of text.
True
2
What permissions are required to execute a shell script in a manner similar to any other executable program on the system?

A) read
B) write and read
C) execute
D) read and execute
D
3
The ability to extract, manipulate, and format text using pattern action statements belongs to which command below?

A) sed
B) grep
C) awk
D) nl
C
4
What number represents the stdin file descriptor?

A) 0
B) 1
C) 2
D) 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
What character is used to delimit most Linux configuration files?

A) tab
B) colon
C) space
D) semicolon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
You are limited to using one pipe | metacharacter on the command line to pipe information from one command to another command.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Select the escape sequence that is used for a form feed:

A) \n
B) \f
C) /f
D) /n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
A list of all exported environment and user-defined variables in a shell can be viewed with what command below?

A) env
B) set
C) setenv
D) getenv
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The standard output and standard error from a terminal screen within the BASH shell can be redirected to a file on the filesystem using what shell metacharacter, followed by the absolute or relative pathname of the file?

A) #
B) <
C) >
D) |
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
Select the metacharacter that can be used to send the standard output of one command to another command as standard input:

A) <
B) |
C) >
D) #
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
What number represents the stderr file descriptor?

A) 0
B) 1
C) 2
D) 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
The default BASH shell prompt is set by an environment variable. What command can be used to view this variable?

A) ls $PWD
B) echo #PWD
C) echo $PS1
D) ls #PS1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The environment variables that are set by default and their current values can be viewed with what command?

A) env
B) get
C) set
D) setenv
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which command can be used to count the number lines, words, and characters in a file?

A) pr
B) nl
C) tr
D) wc
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
In order to redirect a file to the standard input of a command, what metacharacter should be used?

A) >
B) #
C) |
D) <
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
What 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
What command can be used to replace characters in a file sent via Standard Input?

A) tr
B) rt
C) ts
D) st
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Any command that can be executed on the command line can also be placed inside any environment file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The first line in a shell script, which defines the shell that will be used to interpret the commands in the script file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
The ____________________ environment variable contains a list of directories to search for executable programs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Explain the while construct, and demonstrate how it can be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
Select the escape sequence that starts a new line when used with echo:

A) ​\\
B) ​\a
C) ​\n
D) ​\r
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
Detail shell scripts and explain how they are used and executed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A special construct used in a shell script to alter the flow of the program based on the outcome of a command or contents of a variable. Common decision constructs include if, case, &&, and ||.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Select the test statement that can 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 ]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
Provide information on decision constructs, and explain how to use the most common type of decision construct.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A special construct used in a shell script to execute commands repetitively. Common decision constructs include for and while.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The ____________________ command takes user input from stdin and places it in a variable specified by an argument.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Describe what file descriptors are, and then list three that can be used within the BASH shell, and discuss how they can be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
Describe shell variables, and explain environment and user-defined variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Most commands that are run by the shell are run in a separate ____________________, which is created by the current shell.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
A case construct must be ended by ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
What character combination at the start of a shell script are referred to as a hashpling, and allow for the specification of the shell that interprets the contents of the script?

A) ​@!
B) ​#!
C) ​//
D) ​->
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents information input to a command during execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
​What construct is intended for use in processing a list of objects, such as files, directories, users, printers, and so on?

A) ​for
B) ​while
C) ​case
D) ​switch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
​What operator below is known as the NOT operator?

A) ​-o
B) ​-a
C) ​!
D) ​%
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A variable that is altered by loop constructs to ensure that commands are not executed indefinitely.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
Any command that can take standard input and transform it into standard output is called a(n) ____________________ command.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
In an if construct, what statements are optional?​

A) ​fi
B) ​elif
C) ​else
D) ​then
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
Select the two escape sequences that represent a horizontal tab and a vertical tab, respectively:​

A) ​\V
B) ​\t
C) ​\v
D) ​\b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The numeric labels used to define command input and command output.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The process of changing the default locations of Standard Input, Standard Output, and Standard Error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
​What two BASH environment variables represent the current working directory, and the absolute pathname of the current shell, respectively?

A) ​PWD
B) ​CWD
C) ​PATH
D) ​SHELL
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​The variables that store information commonly accessed by the system or programs executing on the system; together, these variables form the user environment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
Select the two commands below that will provide the number of lines in a file, and the number of characters in a file, respectively:​

A) ​count -c
B) ​pr -d
C) ​wc -l
D) ​wc -c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
What two files below are the first two BASH environment files to be executed?​

A) ​/etc/profile
B) ​/etc/bashrc
C) ​˜/.bashrc
D) ​˜/.bash_profile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents any error messages generated by a command.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
​Match each correct item with the statement below.​
a.​counter variable
b.decision construct​
c.​environment variables
d.​file descriptors
e.​hashpling
f.loop construct​
g.​redirection
h.Standard Error (stderr)​
i.​Standard Input (stdin)
j.Standard Output (stdout)
​A file descriptor that represents the desired output from a command.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.