Review 3-1 Linux+ Bash Shell
What special character represents 0 or more characters on the Bash shell command line?
*
Which of the following files is always executed immediately after any user logs in to a Linux system and receives a BASH shell?
/etc/profile
Under Bash shell, the environment variable PATH contains the absolute pathnames of:
A list of directory paths to be searched to locate an external command
Under the Bash Shell the command: cat myaliases > ronsaka 2> errors will
All of the above
The names of the common shell programs in Linux are:
Bash, Tcsh/Csh, Ksh, and Zsh.
BASH is an acronym for:
Bourne Again Shell
Under Bash Shell, the command: city=Los Angeles
Creates a user-defined variable, called city, and initializes it to Los Angeles - WRONG It sets city to Los and tries to execute Angeles as a command, which, normally, will generate an error message.
After executing the following command: ls /etc/hosts /etc/h 2>badoutput What will be the contents of badoutput?
Error messages generated by the command, if any.
Because stderr and stdout represent the results of a command and stdin represents the input required for a command, only stderr and stdout can be redirected to/from a file.
False
What is the difference in output between these two command: echo The working directory is `pwd` echo The working directory is $(pwd)
In the first command pwd is expanded to display the working directory, while in the second command the variable pwd is displayed. - WRONG They are identical in result.
What does &> accomplish when entered on the command line after a command?
It redirects both stderr and stdout to the same location.
Under Bash Shell, the command: echo The current date is `date` creates:
Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell
Under Bash shell, the command: export place=Austin
Makes a copy of the current value of the shell variable place available to the commands/scripts executed under the shell
What is the symbol that creates a pipe between commands?
None of the above
What is the difference between a shell function and a shell script?
Only answers A and C are correct. - WRONG All of the above is the answer.
The Bash Shell command to create variable: "SUM" and assign "0" to it is:
SUM=0
Which of the following commands will declare file descripter 2 (stderr) to be a dupblicate of file descripter 1 (stdout) and sends both to the tr command?
The token |& is shorthand for 2>&! | and either will send output redirected through a pipe to another command. cat myfile names |& tr "[a-z]" "[A-Z]"
Both aliases and functions can be used to store commands that can be executed, but functions also accept positional parameters.
True
The sed and awk commands are filter commands commonly used to format data within a pipe?
True
What would be the effect of using the alias command to make an alias for the date command named "cat" in honor or your favorite pet?
When you use the cat command at the command prompt with the intention of viewing a text file, the date appears instead.
If your search path does not include the path to a particular shell file, and you try to run that shell file by typing its name on the command line, what happens?
You will get an error message of "command not found"..
Under Bash shell, the environment variable HOME contains the absolute pathname of:
Your home directory
The error message: "permission denied" occurs when:
a file name entered at the shell prompt is not executable.
The list of directories stored in the PATH variable is known as
a search path
When interpreting your commands, the shell assumes the first word you type on the command line is
a valid Linux command name.
What command will create an alias name dir which will execute the "ls -al" command?
alias dir='ls -al'
Which of the following will display the message "welcome home" if the cd /home/user1 command is successfully executed?
cd /home/user1 && echo "welcome home"
How do double quotation marks (") differ from single quotation marks (') affect expansion on the command line?
double quotations permit variable and parameter expansion while single quotations suppress all expansions.
Which command can be used to display the value of a specific variable?
echo
The current value for the HOME variable is displayed by which of the following commands?
echo $HOME
Before a user-defined variable can be used by processes that run in subshells, that variable must be ____________.
exported
What command displays commands from the history list?
history
Under Bash shell, the following command creates a user-defined shell variable, called name, and initializes it to John Doe:
name= "John Doe" - WRONG All of the first three commands will work.
Which command could you use to see a list of all environment and user-defined shell variables as well as their current values.
set
For each command that can be manipulated by the BASH shell, which of the following are valid file descriptors?
stdin stderr stdout
Under Bash shell, the command: export CDPATH=$HOME:$HOME/MyFiles causes:
the cd command to search the HOME directory - WRONG The cd command will search the HOME directory, the MyFiles directory, then the working directory.
What command removes the variable "name" that has been created in a shell?
unset name
Variables "name" and "place" can be made constant by:
use of the readonly command.
The command: echo \$person
will display the string: "$person"
