TestOut Linux Pro Exam2 Questions Solved 100%
Correct | Verified Solutions
/etc/shells - ✔✔If a shell type is installed, it will be listed in the /etc/shells file. You
can switch to any shell by typing the shell's name. For example, type ksh within any shell
to switch to the Korn shell.
echo $SHELL - ✔✔The echo $SHELL command returns the default or preferred shell.
The environment $SHELL holds the user's preferred shell which is typically set in
/etc/passwd. For example, if bash is the user's preferred shell, $SHELL will hold the
value, /bin/bash. The preferred shell does not change when you switch shell types.
echo $0 - ✔✔The echo $0 command can be used to return the current shell type. The
special variable $0 normally holds the command used to start a script. A shell session is
initiated by a script. Consequently, $0 will hold the name of the script which is
consistent with the shell type. For example, $0 in a console session running bash might
hold the value -bash, $0 in a terminal application opened from a desktop menu might
hold the value bash. When you type ksh, the ksh script is run, a Korn shell session is
opened and $0 will hold the value ksh.
all shells share some common characteristics: - ✔✔The shell provides a command
line interface that allows the user to interact with the Linux kernel.
A Linux system can run multiple shell sessions at the same time.
One shell session can run within another shell session. This may be done interactively,
such as when a user starts a second shell from the first shell's command line, or
automatically, by scripts or programs.
Shells use configuration files to establish their operating environments.
bash shell default command line prompt - ✔✔The username of the current user
,The @ symbol
The hostname
A space
The base name of the current working directory
~ - ✔✔If the current working directory is the home directory (the default directory
when the user first logs in), the tilde symbol (~) is displayed instead.
# character - ✔✔indicates that the current user is the root user.
$ character - ✔✔indicates that the current user is a normal user.
$PATH environment variable - ✔✔contains the set of directories that are searched
when you type an executable file at the shell prompt.
The shell does not look in the current working directory for the executable file.
To see the list of directories, type echo $PATH at the shell prompt.
To add a directory to a path, type PATH=$PATH:[directory_path] and then type export
PATH.
Type the filename at the shell prompt. (run an executable) - ✔✔Resides in a directory
that is included in the $PATH environment variable
Type ./ followed by the filename. (run an executable) - ✔✔Resides in the current
working directory and the current directory is not included within the path environment
variable
, Type the full path to the executable file. (run an executable) - ✔✔Does not reside in
the current working directory and its directory is not included within the path
environment variable
file names and paths - ✔✔are case sensitive
Linux shell history of commands - ✔✔The commands are stored as a history queue
within the hidden .bash_history file in your home directory.
Press the Up and Down keys to scroll through your previously typed commands.You can
edit the command or re-run it as is by pressing Enter.
Type history - ✔✔to display the commands stored in the history queue.
Type history -c - ✔✔to clear the history queue.
Tab - ✔✔The commands are stored in the .bash_history file in your home directory.
After typing the beginning of a command, file, or directory, press Tab to complete it.
If pressing Tab does not fully complete the command, file, or directory, press Tab
again.If there is no matching command, file, or directory name, your command entry
will not change.If there is more than one matching command, file, or directory name, a
list of all matches will be displayed to help you resolve your command entry.
pwd - ✔✔Shows the present working directory.
whoami - ✔✔Displays the current username.
uname - ✔✔Prints system information. The uname command has the following
options:
Correct | Verified Solutions
/etc/shells - ✔✔If a shell type is installed, it will be listed in the /etc/shells file. You
can switch to any shell by typing the shell's name. For example, type ksh within any shell
to switch to the Korn shell.
echo $SHELL - ✔✔The echo $SHELL command returns the default or preferred shell.
The environment $SHELL holds the user's preferred shell which is typically set in
/etc/passwd. For example, if bash is the user's preferred shell, $SHELL will hold the
value, /bin/bash. The preferred shell does not change when you switch shell types.
echo $0 - ✔✔The echo $0 command can be used to return the current shell type. The
special variable $0 normally holds the command used to start a script. A shell session is
initiated by a script. Consequently, $0 will hold the name of the script which is
consistent with the shell type. For example, $0 in a console session running bash might
hold the value -bash, $0 in a terminal application opened from a desktop menu might
hold the value bash. When you type ksh, the ksh script is run, a Korn shell session is
opened and $0 will hold the value ksh.
all shells share some common characteristics: - ✔✔The shell provides a command
line interface that allows the user to interact with the Linux kernel.
A Linux system can run multiple shell sessions at the same time.
One shell session can run within another shell session. This may be done interactively,
such as when a user starts a second shell from the first shell's command line, or
automatically, by scripts or programs.
Shells use configuration files to establish their operating environments.
bash shell default command line prompt - ✔✔The username of the current user
,The @ symbol
The hostname
A space
The base name of the current working directory
~ - ✔✔If the current working directory is the home directory (the default directory
when the user first logs in), the tilde symbol (~) is displayed instead.
# character - ✔✔indicates that the current user is the root user.
$ character - ✔✔indicates that the current user is a normal user.
$PATH environment variable - ✔✔contains the set of directories that are searched
when you type an executable file at the shell prompt.
The shell does not look in the current working directory for the executable file.
To see the list of directories, type echo $PATH at the shell prompt.
To add a directory to a path, type PATH=$PATH:[directory_path] and then type export
PATH.
Type the filename at the shell prompt. (run an executable) - ✔✔Resides in a directory
that is included in the $PATH environment variable
Type ./ followed by the filename. (run an executable) - ✔✔Resides in the current
working directory and the current directory is not included within the path environment
variable
, Type the full path to the executable file. (run an executable) - ✔✔Does not reside in
the current working directory and its directory is not included within the path
environment variable
file names and paths - ✔✔are case sensitive
Linux shell history of commands - ✔✔The commands are stored as a history queue
within the hidden .bash_history file in your home directory.
Press the Up and Down keys to scroll through your previously typed commands.You can
edit the command or re-run it as is by pressing Enter.
Type history - ✔✔to display the commands stored in the history queue.
Type history -c - ✔✔to clear the history queue.
Tab - ✔✔The commands are stored in the .bash_history file in your home directory.
After typing the beginning of a command, file, or directory, press Tab to complete it.
If pressing Tab does not fully complete the command, file, or directory, press Tab
again.If there is no matching command, file, or directory name, your command entry
will not change.If there is more than one matching command, file, or directory name, a
list of all matches will be displayed to help you resolve your command entry.
pwd - ✔✔Shows the present working directory.
whoami - ✔✔Displays the current username.
uname - ✔✔Prints system information. The uname command has the following
options: