Free LPI 101-500 Exam Practice Questions & Explanations
Prepared & Reviewed by the ValidExamDumps Editorial Team
At ValidExamDumps, we consistently monitor updates to the LPI 101-500 exam questions by LPI. Whenever our team identifies changes in the exam questions, objectives, focus areas or requirements, We immediately update our exam questions for both PDF and online practice exams. This commitment ensures our customers always have access to the most current and accurate questions. By preparing with these up to date and 100% exam domain coverage questions, our customers can successfully pass the LPIC-1 Exam 101, Part 1 of 2 exam on their first attempt without needing additional materials or study guides.
Other certification materials providers often include outdated or removed questions by LPI in their 101-500 exam. These outdated questions lead to customers failing their LPIC-1 Exam 101, Part 1 of 2 exam. In contrast, we ensure our questions bank includes only precise and up-to-date questions. Our main priority is your success in the LPI 101-500 exam, not profiting from selling obsolete exam questions in PDF or Online Practice Test.
Which command uninstalls a package but keeps its configuration files in case the package is re-installed?
The command that uninstalls a package but keeps its configuration files in case the package is re-installed is dpkg -r pkgname. The dpkg command is the low-level tool for installing, building, removing, and managing Debian packages. The -r or --remove option removes an installed package from the system, but it does not delete the configuration files and other data that belong to the package. This way, if the package is re-installed later, the previous settings are preserved.The dpkg command is part of the101.1 Determine and configure hardware settingstopic of theLPI Linux Essentialscertification program12.
The other options are either invalid or do not perform the desired task. The dpkg -s pkgname command shows the status of an installed package, but it does not uninstall it. The dpkg -L pkgname command lists the files that belong to an installed package, but it does not uninstall it. The dpkg -P pkgname command purges an installed or removed package, which means it deletes the configuration files and other data that belong to the package. The dpkg -v pkgname command shows the version of an installed package, but it does not uninstall it.
The system configuration file named _______ is commonly used to set the default runlevel. (Please provide the file name with full path information)
The system configuration file named/etc/inittabis commonly used to set the default runlevel. This file contains information about the initialization process of the system, and it defines the default runlevel, the available runlevels, and the actions to be taken when entering or leaving a runlevel. The default runlevel is the mode of operation that the system starts up into, and it determines which services and processes are running. The default runlevel is specified by a line similar to the following in the /etc/inittab file:
id:5:initdefault:
The number after the first colon indicates the default runlevel, which can range from 0 to 6. The meaning of each runlevel is:
0 --- Halt
1 --- Single-user text mode
2 --- Not used (user-definable)
3 --- Full multi-user text mode
4 --- Not used (user-definable)
5 --- Full multi-user graphical mode (with an X-based login screen)
6 --- Reboot
To change the default runlevel, edit the /etc/inittab file as root and change the number to the desired runlevel. For example, to change the default runlevel to 3, use the following command:
sudo nano /etc/inittab
And change the line to:
id:3:initdefault:
Then save and exit the file. The changes will take effect on the next reboot.
SysV Init Runlevels - Red Hat Customer Portal
init - How can I see or change default run level? - Ask Ubuntu
Topic 5, New Questio ns Mix
Which of the following explanations are valid reasons to run a command in the background of your shell?
Running a command in the background of your shell means that the command will execute asynchronously, without blocking the shell prompt or waiting for user input. This can be useful for commands that take a long time to complete, or that do not require user interaction. One of the valid reasons to run a command in the background is when the command has to run immediately but the user needs to log out. For example, if the user wants to start a backup process that will take several hours, but also wants to close the terminal session and log out from the system, they can run the backup command in the background by appending an ampersand (&) to the command line. This way, the backup command will continue to run even after the user logs out, and the user can check the status or output of the command later. The other options are either incorrect or not applicable. Running a command in the background does not affect the execution priority of the command, which is determined by the nice value and the scheduler. Running a command in the background does not delay the execution of the command, which will start as soon as possible. Running a command in the background does not guarantee that the command will survive a system shutdown or reboot, unless the command is configured to do so with a service manager or a startup script.Reference:
LPIC-1 Exam 101 Objectives, Topic 103: GNU and Unix Commands, 103.1 Work on the command line
LPIC-1 Linux Administrator 101-500 Exam FAQ, LPIC-1 Exam 101 Objectives, GNU and Unix Commands (Total Weight: 25)
Which of the following statements is correct regarding the command foo 1> bar?
The commandfoo 1> barredirects the standard output (stdout) from the command foo to the file bar, overwriting the existing contents of the file. The number 1 before the redirection operator > indicates the file descriptor of the stdout stream, which is 1 by default. The redirection operator > means that the output of the command is written to the file, replacing any previous data in the file. The file name after the redirection operator is the destination of the output. For example, if the command foo prints ''Hello world'' to the stdout, and the file bar contains ''Goodbye world'', the commandfoo 1> barwill write ''Hello world'' to the file bar, erasing ''Goodbye world''. The other options are not correct because:
A . The stdout from the command foo is appended to the file bar: This is not what 1> does, because it overwrites the file, not appends to it. To append the output to the file, the operator >> should be used instead of >.
C . The command foo receives its stdin from the file bar: This is not what 1> does, because it redirects the output, not the input. To redirect the input from the file, the operator < should be used instead of >.
D . The command foo receives its stdin from the stdout of the command bar: This is not what 1> does, because it redirects the output to a file, not to another command. To redirect the output to another command, the operator | (pipe) should be used instead of >.
E . The stderr from the command foo is saved to the file bar: This is not what 1> does, because it redirects the stdout, not the stderr. To redirect the stderr, the file descriptor 2 should be used instead of 1.
Which command must be entered before exiting vi to save the current file as filea.txt?
The correct answer is D, :w filea.txt. This command will save the current file as filea.txt before exiting vi. The syntax of the command is:
:w [filename]
The colon (:) begins command-input mode, which allows the user to enter commands at the bottom of the screen. The w stands for write, which means to save the file. The filename is the name of the file to be saved. If no filename is given, the command will save the file with the same name as the original file.
Therefore, the command :w filea.txt will save the current file as filea.txt and return to command mode. To exit vi, the user can then enter :q, which stands for quit.
The other commands are incorrect for the following reasons:
A, %s filea.txt: This command will not save the file, but it will try to substitute the string filea.txt in the file. The syntax of the command is:
:%s/pattern/replacement/
The % symbol means to apply the command to the whole file. The s stands for substitute, which means to replace a pattern with another pattern. The pattern is the string to be matched, and the replacement is the string to replace the matched string. However, this command is incomplete, because it does not have a replacement or a delimiter. The command will cause an error and will not save the file.
B, %w filea.txt: This command will not save the file, but it will try to write the file to a filter. The syntax of the command is:
:%w !command
The % symbol means to apply the command to the whole file. The w stands for write, which means to save the file. The ! symbol means to execute an external command. The command is the name of the filter to which the file is written. However, this command is incomplete, because it does not have a ! symbol or a filter name. The command will cause an error and will not save the file.
C, :save filea.txt: This command will not save the file, but it will try to save the file under a new name and switch to the new file. The syntax of the command is:
:saveas filename
The saveas command is similar to the write command, but it also changes the current file name to the new file name. However, this command is incorrect, because it does not have the as keyword after save. The command will cause an error and will not save the file.
E, :s filea.txt: This command will not save the file, but it will try to substitute the string filea.txt in the current line. The syntax of the command is:
:s/pattern/replacement/
The s stands for substitute, which means to replace a pattern with another pattern. The pattern is the string to be matched, and the replacement is the string to replace the matched string. However, this command is incomplete, because it does not have a replacement or a delimiter. The command will cause an error and will not save the file.
How to Save a File in Vi / Vim Editor & Quit - phoenixNAP
How to Save a File in Vim / Vi and Quit the Editor | Linuxize
How to Save a File in Linux After Using the Vi Command - Computer Hope
How to Save a File in Vi / Vim Editor in Linux - Tecmint
How to Save a File in Vi / Vim Editor & Quit - GeeksforGeeks
