Courseiva

LPIC-1 Linux Installation and Package Management Practice Question

Which TWO directories are commonly used to store source code before compiling? (Choose two.)

⚠ Common exam trap

A common mix-up: candidates confuse /usr/src with /var/src (which does not exist in the FHS) or assume /tmp is appropriate for source code, overlooking the FHS's explicit design for persistent source storage in /usr/src and /usr/local/src.

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

✓

/usr/src

In Linux, source code for compiling software is conventionally stored in /usr/src (for kernel sources or distribution-provided source packages) and /usr/local/src (for locally compiled software not managed by the package manager). These directories follow the Filesystem Hierarchy Standard (FHS), which designates /usr/src for system-wide source and /usr/local/src for locally installed source code.

Answer analysis

Option-by-option breakdown

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

  • ✗

    /tmp

    Why it's wrong here

    /tmp holds transient runtime files and is cleared on reboot or by tmpwatch, so uncommitted source there can vanish mid-build. It is tempting because it is world-writable and always available for quick scratch work — acceptable for throwaway test files, not persistent source trees awaiting compilation.

  • ✗

    /var/src

    Why it's wrong here

    /var/src is not part of the Filesystem Hierarchy Standard; /var holds variable data such as logs, spools and caches, not source trees. It is tempting because /var feels like a plausible place for miscellaneous data — valid for variable state like /var/log or /var/spool, not for source code.

  • ✓

    /usr/src

    Why this is correct

    /usr/src is the conventional Linux location for kernel and package source trees awaiting compilation, satisfying the stem's requirement for a directory used to store source code before building. It is distinct from /usr/local/src, which holds locally compiled software sources.

  • ✓

    /usr/local/src

    Why this is correct

    /usr/local/src is the conventional location for locally compiled source trees, satisfying the question's requirement for a directory holding code prior to compilation. Unlike /usr/src, which package managers and kernel headers typically populate, this path is reserved for administrator-managed sources, so extracted tarballs sit there before building.

  • ✗

    /opt

    Why it's wrong here

    /opt is reserved for add-on application packages and their binaries, not for source code awaiting compilation. It is tempting because administrators install third-party software there, so it looks like a natural workspace — correct for vendor application bundles, but source belongs under /usr/src or /usr/local/src.

About these practice questions

This LPIC-1 question is part of Courseiva's 402-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.