100% Latest & Updated LPI 102-500 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 1
An engineer changes ~/.profile, but a user's SSH login shell continues to show the old PATH after starting a fresh login session; ~/.bash_profile also exists. What underlying Linux behavior should the administrator identify first?
- The read builtin normally treats backslashes as escapes unless -r is supplied.
- Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
- A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter.
- An unquoted empty expansion removes an argument from the test expression.
Explanation
Correct Answer
B:Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read. That cause connects the stated symptom to the corrective action: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
Incorrect Answers
A:That choice responds to a read lines without mangling backslashes failure. In this incident, Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
C:A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. could help with interpreter line selects bash; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Start a fresh bash login shell and inspect PATH after tracing which profile was read.
D:An unquoted empty expansion removes an argument from the test expression. That describes a different fault. Here, Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
Question 2
An engineer changes ~/.profile, but a user's SSH login shell continues to show the old PATH after starting a fresh login session; ~/.bash_profile also exists. What action should be planned as the next targeted correction?
- Use read -r target and validate target before acting on it.
- Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Place the network probe inside a for loop with a properly bounded sequence and do/done.
Explanation
Correct Answer
B:Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it. It addresses the root cause, while Document which login startup file owns environment customization and avoid conflicting definitions. reduces future recurrence.
Incorrect Answers
A:Use read -r target and validate target before acting on it. could help with read input instead of hardcoding; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Start a fresh bash login shell and inspect PATH after tracing which profile was read.
C:It would address successful command chaining rather than the present problem. The appropriate correction here is: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
D:This option assumes In POSIX shell the loop body must be between do and done to repeat each operation. The reported symptoms instead call for: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
Question 3
An engineer changes ~/.profile, but a user's SSH login shell continues to show the old PATH after starting a fresh login session; ~/.bash_profile also exists. What focused test would distinguish a real correction from a cosmetic change?
- Start a fresh bash login shell and inspect PATH after tracing which profile was read.
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
- Log each expected host ID and verify all four are tested once.
- Exercise the condition with 9, 10 and 12 and inspect its exit status.
Explanation
Correct Answer
A:Start a fresh bash login shell and inspect PATH after tracing which profile was read. The observation confirms the diagnosis or falsifies it before declaring the incident resolved.
Incorrect Answers
B:This belongs to interpreter line selects bash, where A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. The current issue instead is: Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
C:It would address loop over ordered sequence rather than the present problem. The appropriate correction here is: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
D:This option assumes Shell test string comparison does not perform numeric ordering; integer flags such as -gt are needed. The reported symptoms instead call for: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
Question 4
An engineer changes ~/.profile, but a user's SSH login shell continues to show the old PATH after starting a fresh login session; ~/.bash_profile also exists. Which repeatable check would reduce recurrence?
- Use shell syntax checks and a controlled small fixture before rolling out looping probes.
- Document which login startup file owns environment customization and avoid conflicting definitions.
- Test both branches of operational recovery scripts with controlled return codes.
- Gate success-side effects on checked exit statuses instead of command order alone.
Explanation
Correct Answer
B:Document which login startup file owns environment customization and avoid conflicting definitions. The underlying risk is Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
Incorrect Answers
A:Use shell syntax checks and a controlled small fixture before rolling out looping probes. belongs to a situation where In POSIX shell the loop body must be between do and done to repeat each operation. Here the evidence supports a different requirement: Document which login startup file owns environment customization and avoid conflicting definitions.
C:This belongs to conditional recovery on failure, where The fallback lacks a failure condition, so it executes on the successful path as well. The current issue instead is: Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
D:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
Question 5
An engineer changes ~/.profile, but a user's SSH login shell continues to show the old PATH after starting a fresh login session; ~/.bash_profile also exists. Which TWO options provide a coherent remediation-and-test response to this incident?
- Run the script with the parameter empty, unset and populated to verify branching.
- Start a fresh bash login shell and inspect PATH after tracing which profile was read.
- Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
- Gate success-side effects on checked exit statuses instead of command order alone.
- Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
Explanation
Correct Answers
B:Start a fresh bash login shell and inspect PATH after tracing which profile was read. It distinguishes a genuine correction from a superficial edit that has not addressed the underlying cause: Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
C:Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it. It addresses the root cause, while Document which login startup file owns environment customization and avoid conflicting definitions. reduces future recurrence.
Incorrect Answers
A:Run the script with the parameter empty, unset and populated to verify branching. could help with avoid globbing in scalar tests; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Start a fresh bash login shell and inspect PATH after tracing which profile was read.
D:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read.
E:It would address avoid globbing in scalar tests rather than the present problem. The appropriate correction here is: Move the intended PATH export into ~/.bash_profile or deliberately source ~/.profile from it.
Question 6
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. Which failure condition fits the evidence without assuming an unrelated fault?
- The script passes a command name as text instead of performing command substitution.
- The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it.
- The fallback lacks a failure condition, so it executes on the successful path as well.
- Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
Explanation
Correct Answer
D:Interactive non-login Bash reads ~/.bashrc rather than the login profile by default. Addressing the cause requires: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
Incorrect Answers
A:The test for capture command output safely would be: Inspect the generated record and confirm it contains the evaluated short hostname. The relevant acceptance check here is: Open a new ordinary terminal and use type to verify the alias is visible.
B:This option assumes The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
C:The fallback lacks a failure condition, so it executes on the successful path as well. That describes a different fault. Here, Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
Question 7
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. Which intervention addresses the specific problem with the least unrelated change?
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Quote "$file" at each use and iterate safely over properly expanded pathnames.
- Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
- Use #!/usr/bin/env bash or an approved absolute Bash path for the Bash-dependent script.
Explanation
Correct Answer
C:Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed. It is the direct response; verify the result by: Open a new ordinary terminal and use type to verify the alias is visible.
Incorrect Answers
A:That choice responds to a successful command chaining failure. In this incident, Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
B:This option assumes Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
D:It would address interpreter line selects bash rather than the present problem. The appropriate correction here is: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
Question 8
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. Which check would provide the strongest evidence that the fix worked?
- Check effective identity during a controlled run and confirm unauthorized users cannot escalate.
- Open a new ordinary terminal and use type to verify the alias is visible.
- Log each expected host ID and verify all four are tested once.
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
Explanation
Correct Answer
B:Open a new ordinary terminal and use type to verify the alias is visible. The test is evidence-based because the underlying failure was: Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
Incorrect Answers
A:This belongs to script permissions and suid expectations, where Linux generally ignores setuid elevation on interpreter scripts because it is unsafe. The current issue instead is: Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
C:The test for loop over ordered sequence would be: Log each expected host ID and verify all four are tested once. The relevant acceptance check here is: Open a new ordinary terminal and use type to verify the alias is visible.
D:This option assumes A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
Question 9
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. What longer-term control best supports this requirement?
- Validate user input and handle EOF explicitly before destructive administrative operations.
- Add an example of expected expansion to the script's acceptance tests.
- Test numeric boundaries and reject missing or nonnumeric inputs before arithmetic decisions.
- Keep interactive-only customizations in bashrc and test both login and non-login shells.
Explanation
Correct Answer
D:Keep interactive-only customizations in bashrc and test both login and non-login shells. This control detects or prevents the same mechanism before another incident.
Incorrect Answers
A:This option assumes Prompt text alone does not read standard input into a shell variable. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
B:This belongs to capture command output safely, where The script passes a command name as text instead of performing command substitution. The current issue instead is: Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
C:Test numeric boundaries and reject missing or nonnumeric inputs before arithmetic decisions. could help with numeric comparison in sh; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Open a new ordinary terminal and use type to verify the alias is visible.
Question 10
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. Which THREE case-specific steps cover immediate repair, test evidence and sustained control?
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Keep interactive-only customizations in bashrc and test both login and non-login shells.
- Open a new ordinary terminal and use type to verify the alias is visible.
- Validate user input and handle EOF explicitly before destructive administrative operations.
- Log each expected host ID and verify all four are tested once.
- Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
Explanation
Correct Answers
B:Keep interactive-only customizations in bashrc and test both login and non-login shells. Sustained checks matter because Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
C:Open a new ordinary terminal and use type to verify the alias is visible. This measures the specific result of applying: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
F:Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed. The change should be accepted only after this test: Open a new ordinary terminal and use type to verify the alias is visible.
Incorrect Answers
A:This option assumes A semicolon executes the next command regardless of the earlier command's exit code. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
D:Validate user input and handle EOF explicitly before destructive administrative operations. could help with read input instead of hardcoding; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Open a new ordinary terminal and use type to verify the alias is visible.
E:Log each expected host ID and verify all four are tested once. could help with loop over ordered sequence; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Open a new ordinary terminal and use type to verify the alias is visible.
LPI Level 1 (102-500) Practice Tests