Question 77 of 513
Essential CommandsmediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the shell’s hash table is stale, so running hash -r resolves the issue. This occurs because the shell caches the paths of executables in memory to avoid repeatedly scanning the PATH variable; when a new binary like myapp is added to a directory already in PATH, the shell may still hold a cached miss or an outdated entry, causing it to report “command not found” even though the binary exists with correct permissions. On the LFCS exam, this tests your understanding of shell internals and common troubleshooting scenarios—a frequent trap is assuming PATH or permissions are the problem when the real culprit is the shell’s cached lookup. To remember this, think of the shell as having a “phonebook” for commands: if you add a new number (binary) to a known street (directory in PATH), you must refresh the phonebook with hash -r before the shell will find it.

LFCS Essential Commands Practice Question

This LFCS practice question tests your understanding of essential commands. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A system administrator is troubleshooting a user's report that a command 'myapp' is not found. The administrator checks the PATH variable and sees it includes /usr/local/bin. The administrator verifies that the binary 'myapp' exists in /usr/local/bin with permissions 755. However, running 'myapp' still fails with 'command not found'. What is the most likely cause?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1mediummultiple choice
Read the full NAT/PAT explanation →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The shell's hash table is stale; run 'hash -r'

Option C is correct because the shell caches the locations of executables in a hash table to avoid searching PATH repeatedly. When a new binary is added to a directory already in PATH, the shell may still have a stale entry (or no entry) for that command, causing it to report 'command not found' even though the binary exists. Running 'hash -r' clears the entire hash table, forcing the shell to re-scan PATH on the next invocation.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The user's PATH does not include /usr/local/bin

    Why it's wrong here

    The administrator checked the PATH and it includes the directory, but this is the administrator's PATH, not the user's. However, the question implies the administrator is testing as the user or the user's environment is similar.

  • The binary is a shell script missing a shebang

    Why it's wrong here

    If it's a binary, no shebang needed. If it's a script, missing shebang would cause different error.

  • The shell's hash table is stale; run 'hash -r'

    Why this is correct

    Correct: the shell caches command locations, and may not have updated after the binary was added.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The binary does not have execute permission for the user

    Why it's wrong here

    Permissions are 755, so execute is allowed.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Linux Foundation often tests the concept that the shell's hash table can cause 'command not found' errors even when the binary exists and permissions are correct, leading candidates to incorrectly focus on PATH or permissions.

Trap categories for this question

  • Similar concept trap

    The administrator checked the PATH and it includes the directory, but this is the administrator's PATH, not the user's. However, the question implies the administrator is testing as the user or the user's environment is similar.

Detailed technical explanation

How to think about this question

The shell's hash table is stored in memory and maps command names to full paths; it is populated on first execution of a command and updated only when a hash table miss occurs or when explicitly cleared. This behavior is defined by POSIX and is common in bash, ksh, and zsh. In real-world scenarios, this issue often arises after installing new software or updating a script in a directory already in PATH, leading to confusion when the command is not found despite being present.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related LFCS practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free LFCS practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this LFCS question test?

Essential Commands — This question tests Essential Commands — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The shell's hash table is stale; run 'hash -r' — Option C is correct because the shell caches the locations of executables in a hash table to avoid searching PATH repeatedly. When a new binary is added to a directory already in PATH, the shell may still have a stale entry (or no entry) for that command, causing it to report 'command not found' even though the binary exists. Running 'hash -r' clears the entire hash table, forcing the shell to re-scan PATH on the next invocation.

What should I do if I get this LFCS question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More LFCS practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.