Linux LPI 117-101 # 4 Of 9

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Tobyyy
T
Tobyyy
Community Contributor
Quizzes Created: 10 | Total Attempts: 1,461
| Attempts: 122 | Questions: 53
Please wait...
Question 1 / 53
0 %
0/100
Score 0/100
1. What command on an rpm-based system will upgrade any existing packages on a
system, and add any packages needed? Type just the command and switch(es).

Explanation

-U or -F both option is used to upgrade the package. -U option upgrade if
lower version is installed otherwise install the new version package but -F option only
upgrade if lower version package installed. As well as it doesn't add(install) any other
packages.

Submit
Please wait...
About This Quiz
Linux LPI 117-101 # 4 Of 9 - Quiz

This quiz, part of the Linux LPI 117-101 series, focuses on RPM package management commands. It tests skills like verifying package changes, upgrading packages, and querying package information,... see moreessential for Linux system administrators. see less

2. What is the name and full path of the file that contains the system wide aliases and
functions for the default Linux shell?

Explanation

/etc/bashrc file sets the system wide aliases, functions as well as default
permission umask value for root as well as non-root user.

Submit
3. What is the name of the file that runs on user logout, usually set to clear the screen?

Explanation

~/bash_logout file execute when exiting a login shell, Useful for
running programs automatically at logout ie, clear the screen, make backup files,
delete temporary files, display date and time etc

Submit
4. You wish to set your shell options so that the output from a redirect will NOT
overwrite an existing file. Type the command including switches.

Explanation

noclobber global option controls the file overwriting to an existing file.
set -o : Lists all options with on/off status
set -o noclobber : Set on the noclobber and restrict to use the redirect (>) symbol.
set +o noclobber : Set off the noclobber and allow to use the redirect (>) symbol.

Submit
5. What 3 letter command will show you the values set by the /etc/profile script file for
the entire system?

Explanation

env command is used to display the all environmentall variables as
well as values. Where /etc/profile file is used to set the value into the environmental
variable.

Submit
6. What three letter command in Bash will display all environment variables?

Explanation

env command displays all environmental variables as well as it's value. Where set is another command displays all shell variables.

Submit
7. Type in the command line that will execute cmd2 regardless of exit status of cmd1.
Assume these commands are on the systems PATH and the command names are
cmd1 and cmd2.

Explanation

symbol helps to separate the multiple commands. It never checks the
retrun value so not like the logical operator.
Example: cat a;ls;date : three commands are combined first executes cat command then ls
and then date.

Submit
8. You want to repeat a command that began with the letters 'ab'. How would you do
this?

Explanation

bash shell stores the history commands later we can re-execute the
commands from the history.
!! : To repeat the last entered command
!n : To execute the command from history having n numbered.
!-n : To execute the command entered n command back
!c : To execute the command started from history started by c character.

Submit
9. You wish to turn off the shell option that stops you overwriting exisiting files. Type
the command in that will do this including switches.

Explanation

noclobber global option controls the file overwriting to an existing file.
set -o : Lists all options with on/off status
set -o noclobber : Set on the noclobber and restrict to use the redirect (>) symbol.
set +o noclobber : Set off the noclobber and allow to use the redirect (>) symbol.

Submit
10. What 3 letter command will show you the values set by the /etc/bashrc script file for
the entire system?

Explanation

set command is used to display the all shell as well as environmental
variables as well as variables values. env command is used to display the all
environmentall variables as well as values.

Submit
11. Type just the name of the file in a normal user's home directory that will set their
local user environment and startup programs on a default Linux system.

Explanation

~/bash_profile and ~/bashrc file for user specific settings, common to
place variable settings, aliases, commands that places output to the screen, such as
date command, should go in .bash_profile not .bashrc.

Submit
12. You want to repeat the last command you entered. How would you do this?

Explanation

!! re-excutes the last entered command.
!n : executes the command from history n numbered in history list. You can use the
history command to list all history commands.

Submit
13. What is the name and full path of the file that contains the system wide
Environment variables and Startup programs?

Explanation

The /etc/profile shell scrpt is first startup script run when a login shell
is started. It only runs for the login shells, non-login shells do not invoke this script.
This script will set a series of variables including PATH, USER, LOGNAME, MAIL,
HOSTNAME, HISTSIZE, INPUTRC as well calls the startup programs to execute.

Submit
14. You want to run three commands one after the other, but don't care what exit they
had. What command line would do this?

Explanation

; symbol helps to separate the multiple commands. It never checks the
retrun value so not like the logical operator.
Example: cat a;ls;date : three commands are combined first executes cat command then ls
and then date.

Submit
15. What command on an rpm-based system will upgrade any existing packages on a
system, but not add any packages? Type just the command and switch(es).

Explanation

-U or -F both option is used to upgrade the package. -U option upgrade if
lower version is installed otherwise install the new version package but -F option only
upgrade if lower version package installed. As well as it doesn't add(install) any other
packages.

Submit
16. You want to view a listing of previously entered commands. What command would
you use?

Explanation

history command lists all commands in history. All history commands
stored in ~/.bash_history file.

Submit
17. Type in just the name of the command that allows you to edit the command history,
and will execute the contents of the buffer when exited.

Explanation

fc command allows the history command to edit as well as when you
exit from the edit mode, It will executes the command.

Submit
18. On a default Linux system, what is the name of the file that sets users aliases and
functions?

Explanation

~/bash_profile and ~/bashrc file for user specific settings, common to
place variable settings, aliases, commands that places output to the screen, such as
date command, should go in .bash_profile not .bashrc.

Submit
19. You wish to find out more information on a file e.g. Last accessed, Modified
changed, Inode. What is the simplest command that would show this information
for a file called certkiller?

Explanation

stat command displays the meta information of file.
Example:
stat file1
File: file1
Size: 5 Blocks:8 IO Block: 409 regular file
Device: 30ch/780d Inode: 16217 Links: 2
Access: (0644/-rw-r-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2006-04-16 12:50:44.000000000
Modify: 2006-04-16 12:50:44.000000000
Change: 2006-04-16 12:50:44.000000000

Submit
20. Type in just the name of the default file that the command line history is stored in
for a logged in user.

Explanation

One environmental variable named HISTFILE carrying the name of
file to store the history command. By default the history commands stores in
~/bash_histroy.
You can displays using the variable:
echo $HISTFILE

Submit
21. What command would execute cmd1 followed by cmd2, regardless of the exit status
of cmd1?

Explanation

; symbol helps to separate the multiple commands. It never checks the
retrun value so not like the logical operator.
Example: cat a;ls;date : three commands are combined first executes cat command then ls
and then date.

Submit
22. You want to search the file myfile for all occurrences of a string containing at least
five characters, where character number 2 and 5 are "a" and character number 3 is
NOT "b". Which command would you use?

Explanation

String Processing Tools like grep, sed, awk uses wildcard characters.
. à Any Single character from the range
[abc] à Any Single Character from the set
[a-c] à Any Single Character from the Range
[^abc] à Any Single Character except from the set.
[^a-c] àAny Single Character except from the range.
According to QUESTION, in 2nd and 5th position must be a and in 3rd position not b.
B. . means any single character in first postion., a means a must be in second postions,
[^b] means b must not be in third postion, . means any single character in fourth position
and a in fifth position.

Submit
23. You are in your home directory. You have made changes to your .bash_profile and
incorporated a modified PATH variable. Type in the command that will reread the
 .bash_profile and set the changes you have made.

Explanation

~/.bash_profile executes when loggin shell provided users login. So, to
bring the changes made on ~/bash_login either user should re-login or manually
executest the shell scripts file ~/.bash_profile.

Submit
24. In order to append the output of ls to a file called bazz, which of the following
command lines would you use?

Explanation

Common Redirection Operator:
Command >file à Redirect the Standard Output of command into file.
Command >>file à Append the Standard Output of command into file.
Command Command 2>file à Redirect the error message to file.
Command 2>>file à Append the error message to file.

Submit
25. You see following output while trying to install an updated package:
[root@example pub]# rpm -i gthumb-2.2.0.i386.rpm package gthumb-
1.0.1.i386.rpm is already installed.
Which command will allow you to install the updated version?

Explanation

Syntax of rpm command
rpm [options] package
-i à Install
-U àUpgrade package if lower version is installed otherwise install the new package.
-F à Upgrade package if only lower version is installed.

Submit
26. Type the command line to check the installed package mypackage for any
configuration file changes since install?

Explanation

Verifying a package compares information about the installed files in
the package with information about the files taken from the package metadata
stored in the rpm database. Among other things, verifying compares the size, MD5
sum, permissions, type, owner and group of each file. Any discrepancies are
displayed.
To verify the package:
rpm -Va or -verify -a packagename

Submit
27. You want to repeat command number 3 in your history. How would you do this?

Explanation

bash shell stores the history commands later we can re-execute the
commands from the history.
!! : To repeat the last entered command
!n : To execute the command from history having n numbered.
!-n : To execute the command entered n command back
!c : To execute the command started from history started by c character.

Submit
28. You have just typed the following three commands and got the following output:

prompt> echo $PATH
/usr/bin:/usr/local/bin:usr/sbin:opt/kde/bin
prompt> pwd
/home/anna/games
promt> ls
game1 game2 game3

You want to run the program game1, but get the response that it is not found.
What did you forget to do?

Explanation

/home/anna directory is not set on path. So to execute the program
from the directory not set in path, should execute by givin full path or use the ./ .
If you are in /home/anna use ./ means under current directory.
To set the directory on path
PATH=$PATH:/home/anna/

Submit
29. What is the correct format for a proper command in the shell?

Explanation

Syntax of executing the command in shell is
command [options] argument
example: ls -l /etc : Where ls is command, -l is option and /etc/ is the parameter or
argument for ls command.

Submit
30. Which command will print to standard out only the lines that do not
begin with # (pound symbol) in the file foobar?

Explanation

rep stands for general regular processor, used to prints all lines
where pattern matched.
Achor symbol used by String Processor tools like sed, awk and grep
^ àLine begins with
$ à Line ends with
\ \>word end with
-v option in grep is non matching.

Submit
31. In Bash, inserting "1>&2" after a command redirects

Explanation

Statndard Input use Standard Output use > symbol and 1 is the integer value
Standard Error use 2> symbol and 2 is the integer value
Example:
find / - name passwd >allresult 1>&2 : Redirects all standard output as well as standard
error to allresult file. Where & is the logical operator.

Submit
32. Which of the following will allow both the commands to execute, regardless of their
individual exit status?

Explanation

; helps to execute the multiple commands in order.
example: clear;ls : First execute clear then ls.
&& is AND logical Operator
|| is OR logical operator
! is NOT logical Operator

Submit
33. Which keystrokes will move the cursor 3 lines down and 4 characters to the right?

Explanation

Cursor Movement in vi editor:
h : Left
j : down
k : up
l : right
Example: when you press the h key it moves the cursor in left of one character.
3h: moves the cursor in 3 characters left

Submit
34. Your Linux machine has 2 monitors. Your second monitor is configures as the
second screen of the first display. If you want the "netscape" program to be
displayed on your second monitor, what command should you use before starting
netscape?

Explanation

Answer C is correct because:
export set DISPLAY=192.168.0.1:0 : means displays on first monitor of 192.168.0.1
host.
export set DISPLAY=192.168.0.1:1 : means on second monitor of 192.168.0.1 host.

Submit
35. Which shell built-in command can be used to create a shortcut or
pseudonym for a longer command? Assume a modern bourne-like shell,
such as bash.

Explanation

Alias command is used to create like shortcut of long command.
Example: alias back="tar -cvf mytar.tar /root/*", here back will be the alias (shortcut) of
complete "tar -cvf mytar.tar /root/*" command.

Submit
36. What switch is used with the usermod command to change a user's secondary groups?

Explanation

Explanation: When we create the user, by default user belongs to it's private group
as a primary group. After adding the user into the system, if you want to change:
usermod -g groupname username
To make user belongs to secondary group:
usermod -G groupname username

Submit
37. You have to test a new kernel version. Which of the following is the
best way to add a new linux kernel in your system?

Explanation

Syntax of rpm command
rpm [options] package
-i à Install
-U àUpgrade package if lower version is installed otherwise install the new package.
-F à Upgrade package if only lower version is installed.

Submit
38. Which command will output the exit status of the previous command (a 1 or a 0)?

Explanation

$? is used to displays to catch the return value. When command
executes it returns 0 or other value. 0 means command is executed successfully and
other value means executed with error.
Example:
function test1()
{
echo "From test1 function"
return 1
}
echo "Retrun Value is " $?

Submit
39. You have two shell scripts, foo and bar. You wish to have bar execute if foo returns
an exit status of 0. Select the correct command:

Explanation

&& à Logical AND Operator

|| à Logical OR Operator
! à Logical NOT Operator
Correct Answer is C because first tried to execute foo. If foo executes without any error
then executes bar. If any error occurs in foo then exit from command.

Submit
40. Which of the following will cause command2 not to execute if command1 fails?

Explanation

&& is the Logical AND operator, whiche means second command
executes if first command excuted successfully.
Example: cat a && ls : if cat a executes successfully then only ls command will execute
other wise exit from the cat command.

Submit
41. What option is used with the useradd command to specify the user's home directory?

Explanation

useradd command is used to add the user in the system. By default it
creates the user's home directory in /home if you want to specify the user's home
directory in different location use the -d and name of directory with path.
Example:
useradd -d /var/user1 user1
useradd -s /bin/sh user1 : Sets the sh shell as default shell to user user1
After adding the user use the usermod command to change the user's home directory,
login shell, account lock, account unlock etc.

Submit
42. How can you execute two commands, the second one being executed only if the first
returns a nonzero (program execution failed) exit status?

Explanation

|| is called the Logical OR Operator, which means either in sense eiher
first or second. If first command exited with error then only second executes.
Example: cat a || ls : if cat command return the error code then start to execut the ls
command.
Remember that if command executes successfully then it returns zero value and if
command executes with error it returns the error code.

Submit
43. Which command will print line numbers before each line in a file?

Explanation

cat command is used to display the contents of file in standard output.
Syntax: cat [option] filename.
Options: -n, -b à Display the line number before each line
-A à Show all characters including control characters.
-s à Squeeze multiple adjacent blank lines into one line

Submit
44. You are adding a new user. You want to create the user's home directory only if the
directory does not exist. Which of the following would accomplish this?

Explanation

When we issue the useradd command, it creates the user by creating
the user's home directory into /home.
If you create the user's home directory into different location:
useradd -d directory username
If you want to check whether user's directory is already created or not :
useradd -m

Submit
45. You want to preview where the package file,
apache- xml.I386.rpm, will install its files before installing it. What
command do you issue?

Explanation

rpm -qpl apache-xml.i386.rpm

Submit
46. You have a dual-head workstation with two monitors. Your secondary monitor is
defined as the second screen of the first display. You want to start Mozilla and
display its window on the second display. Which command line would you use to
achieve this?

Explanation

Answer C is correct because:
export set DISPLAY=192.168.0.1:0 : means displays on first monitor of 192.168.0.1
host.
export set DISPLAY=192.168.0.1:1 : means on second monitor of 192.168.0.1 host.

Submit
47. When a user executes the command "ps ax", what is shown on the console? Choose
all that apply.

Explanation

Process are running in two different methods: one is terminal
dependent (means controlled by terminal ) and second is terminal independent
(terminal independent).
ps -a: All process not including not controlled by terminal
ps -x : All process including not controlled by terminal

Submit
48. You have an updated RPM called screensaver-1.1.i386. rpm. You
have version 1.0 installed. Using RPM, how do you view the changelog of
this file to see if you should install the update?

Explanation

Syntax of rpm command
rpm [options] package
-i à Install
-U àUpgrade package if lower version is installed otherwise install the new package.
-F à Upgrade package if only lower version is installed.
-l à List all files belongs to package
-p à Package Name
-q à Query
--changelog à Display change information for the package.

Submit
49. Which command will allow you to find a specific installed package?

Explanation

To query the package whether, package is installed or not :
rpm -qv rpmname
example: rpm -qv ncurses à It shows rpm fullname, version if installed otherwise it will
display package is not installed.
Installed package options:
rpm -qa à Lists all installed packages
rpm -qf filename à Shows owning package
rpm -qi rpmname à General Information of Package
rpm -ql rpmname à Shows all files owning by this package

Submit
50. In which file are you likely to find the settings for umask, path, and ulimit on a per
user basis?

Explanation

~/bash_profile and ~/bashrc file for user specific settings, common to
place variable settings, aliases, commands that places output to the screen, such as
date command, should go in .bash_profile not .bashrc.

Submit
51. Which of the following commands will send output from the program
myapp to both standard output (stdout) and the file file1.log?

Explanation

Answer should be like this: set | tee set.out àtee command helps to
redirect the output to file while piping. Here output of set will display as well as
output redirect to set.out file.

Submit
52. Which of the following are executed ONLY during a Login session? Select all that
apply.

Explanation

Startup scripts: For Login shell
/etc/profile
/etc/profile.d
~/.bash_profile
~/.bashrc
/etc/bashrc
Non-Login Shell
~/.bashrc
/etc/bashrc
/etc/profile.d
/etc/profile, ~/.bash_profile file calls when login shell provided users logged in.
~/.bash_logout: File calls when user logout from the shells, useful for backup, clearing
/tmp etc.

Submit
53. You installed a beta rpm package, but are experiencing some problems with it. How
can you remove this package?

Explanation

To uninstall the package, we use the rpm -ev rpmname or rpm --erase
rpmname
To install package: rpm -ivh rpmname : where -I means install, -v means verbose, -h
means display the Hash marks.
To Upgrade rpm: rpm -Uvh rpmname: where -U means Upgrade.
To Freshen Upgrade : rpm -Fvh rpmname

Submit
View My Results

Quiz Review Timeline (Updated): Jul 23, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 23, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 02, 2009
    Quiz Created by
    Tobyyy
Cancel
  • All
    All (53)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What command on an rpm-based system will upgrade any existing packages...
What is the name and full path of the file that contains the system...
What is the name of the file that runs on user logout, usually set to...
You wish to set your shell options so that the output from a redirect...
What 3 letter command will show you the values set by the /etc/profile...
What three letter command in Bash will display all environment...
Type in the command line that will execute cmd2 regardless of exit...
You want to repeat a command that began with the letters 'ab'. How...
You wish to turn off the shell option that stops you overwriting...
What 3 letter command will show you the values set by the /etc/bashrc...
Type just the name of the file in a normal user's home directory that...
You want to repeat the last command you entered. How would you do...
What is the name and full path of the file that contains the system...
You want to run three commands one after the other, but don't care...
What command on an rpm-based system will upgrade any existing packages...
You want to view a listing of previously entered commands. What...
Type in just the name of the command that allows you to edit the...
On a default Linux system, what is the name of the file that sets...
You wish to find out more information on a file e.g. Last accessed,...
Type in just the name of the default file that the command line...
What command would execute cmd1 followed by cmd2, regardless of the...
You want to search the file myfile for all occurrences of a string...
You are in your home directory. You have made changes to your...
In order to append the output of ls to a file called bazz, which of...
You see following output while trying to install an updated...
Type the command line to check the installed package mypackage for...
You want to repeat command number 3 in your history. How would you do...
You have just typed the following three commands and got the following...
What is the correct format for a proper command in the shell?
Which command will print to standard out only the lines that do...
In Bash, inserting "1>&2" after a command redirects
Which of the following will allow both the commands to execute,...
Which keystrokes will move the cursor 3 lines down and 4 characters to...
Your Linux machine has 2 monitors. Your second monitor is configures...
Which shell built-in command can be used to create a shortcut...
What switch is used with the usermod command to change a user's...
You have to test a new kernel version. Which of the following is...
Which command will output the exit status of the previous command (a 1...
You have two shell scripts, foo and bar. You wish to have bar execute...
Which of the following will cause command2 not to execute if command1...
What option is used with the useradd command to specify the user's...
How can you execute two commands, the second one being executed only...
Which command will print line numbers before each line in a file?
You are adding a new user. You want to create the user's home...
You want to preview where the package file,apache- xml.I386.rpm, will...
You have a dual-head workstation with two monitors. Your secondary...
When a user executes the command "ps ax", what is shown on the...
You have an updated RPM called screensaver-1.1.i386. rpm. Youhave...
Which command will allow you to find a specific installed package?
In which file are you likely to find the settings for umask, path, and...
Which of the following commands will send output from the programmyapp...
Which of the following are executed ONLY during a Login session?...
You installed a beta rpm package, but are experiencing some problems...
Alert!

Advertisement