Module 7 Live Virtual Machine Labs 1-8 Flashcards
You need to make the shell script executable. Which of the parameter along with the chmod command should you use?
+x
-x
+rwx
-rwx
+x
lab 7-1
The _______ statements are mainly used for making a decision and therefore, are known as decision-making statements.
until loop
for loop
while loop
if…else
case…esac
if…else
In a scenario, where you have multiple conditions, it is best to use ________ statements.
if…else
for loop
until loop
while loop
case…esac
case esac
Which two loops run until a statement becomes true? [Choose two.]
for loop
while loop
case…esac
until loop
if…else
while loop
until loop
The ______ loop runs through a list of values in a list until the time list values are exhausted.
for loop
if…else
until loop
while loop
case…esac
for loop
lab 7-2
Which variables are contained in /etc/profile? [Choose all that apply.]
USER
PATH
MAIL
HOSTNAME
HISTSIZE
USER
PATH
MAIL
HOSTNAME
HISTSIZE
The ____ profile is the user configuration file in which the user environment can be configured.
~/.bash_profile
~/.bash_login
/etc/profile
/etc/bashrc
~/.bash_profile
If the ~/.bash_profile does not exist, then the __________ file is read.
~/.profile
/etc/bashrc
/etc/profile
~/.bash_login
~/.bash_login
The _________ gets executed only during a login shell.
~/.bash_profile
~/.bash_login
/etc/profile
/etc/bashrc
~/.bash_profile
Which value with the chmod command will make a shell script executable?
100
400
700
444
700
lab 7-3
The default output of a command is displayed on the _______. [Choose all that apply.]
File
Keyboard
Screen
Console
console
screen
The output of a command is redirected to a new file with the help of the _____ operator.
> > <
«
>
Which operator will overwrite the contents of an existing file?
> «_space;
>
<
>
Which operator will append the output to the same file without overwriting it?
> > <
«
> >
lab 7-4
To send the content of one file to another file, you can use the _______ redirector.
«_space;
>
»
<
>
The ________ command is another filter that is used to print the selected output of a file onto the screen.
cp
ls -l
ls
cut
cut
lab 7-5
Which of the following standard input value is used for the default keyboard?
1
3
2
0
4
0
The _______ command is another filter that converts tabs to spaces, without affection the source file. By default, a tab consists of eight spaces.
expand
ls -l
cp
cut
ls
expand
You can use ________ to convert the spaces back to default tabs in a file.
unexpand
cp
cut
expand
ls -l
unexpand
The _______ command is used to define the uniform spacing between words and sentences.
expand
cp
cut
fmt
unexpand
ls -l
fmt
Which two standard output values are used for the default terminal? [Choose two.]
3
4
0
1
2
1
2
To append the information to an existing file, which type of redirector should be used>
> > «<
> >
Which of the following is used for combining two outputs?
|
#
&
>
&
Which operator is typically used with the xargs command?
&
>
#
|
|
lab 7-6
Which command prints partial or full environment variables?
env
print
printenv
set
printenv
Which command prints the name and value of each shell variable available?
printenv
print
set
env
set
Which command prints the all exported environment variables?
print
printenv
set
env
env
lab 7-7
Which of the following is the global profile used for all the users in a Linux system?
/etc/profile
/etc/bash
/etc/users
/etc/hosts
/etc/profile
Which of the following is activated when the user logs on and also loads the environment variables?
/var/passwd
~/bashrc
/etc/hosts
.profile
.profile
Which of the following file is executed when a login shell exits?
.profile
.bash_logout
/etc/hosts
~/bashrc
.bash_logout
Which command will list the environment variables?
top
env
nice
renice
ps
env
Which command enables you to export variables to be used by other processes?
export
env
renice
nice
top
ps
export
lab 7-8
What is the extension of a shell script?
.exe
.txt
.ps
.sh
.sh
Which are two methods to execute a shell script named plab.sh? [Choose two.]
./plab.sh
bash plab.sh
.plab.sh
plab.sh
bash plab.sh
./plab.sh
Which command should you enter to save and exit a file that is opened in the vi editor?
:wq
:sq
:ws
:aq
:wq
Which of the following executes a list of commands repeatedly till the specified condition is reached?
while
do
for
if
while
You can use the ______ loop to check for a condition and perform a task.
for
while
do
if
if