Courseiva
Essential Commands →easyMultiple Select

LFCS Essential Commands Practice Question

Which TWO commands can be used to display the current working directory?

⚠ Common exam trap

Linux Foundation often tests the distinction between commands that display the working directory and commands that merely locate or describe other things, tricking candidates into selecting `which pwd` because it contains the letters 'pwd'.

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

✓

pwd

Option B, `pwd`, is correct because it is the dedicated shell builtin/utility that prints the absolute pathname of the current working directory. Option D, `echo $PWD`, is correct because the shell maintains the `PWD` environment variable holding the current working directory, and `echo` expands it to display that path. Option A, `which pwd`, only locates the executable or builtin for `pwd` and prints its path rather than the working directory. Option C, `date`, displays the current system date and time, and option E, `whoami`, prints the effective username — neither relates to the working directory.

Answer analysis

Option-by-option breakdown

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

  • ✗

    which pwd

    Why it's wrong here

    which locates an executable in PATH and merely prints pwd's path, not the shell's current directory. It is tempting because it involves the pwd command name, and would be correct for resolving where a binary such as pwd is installed.

  • ✓

    pwd

    Why this is correct

    pwd is the shell builtin that prints the absolute pathname of the current working directory, directly satisfying the requirement to display it. It reads the shell's tracked directory state rather than resolving a path argument.

  • ✗

    date

    Why it's wrong here

    The date command prints the system clock and calendar date, not the shell's location in the filesystem. It is tempting because it reports environment context, but it would be correct only when the task is timestamping output or setting the system time, not identifying the current directory.

  • ✓

    echo $PWD

    Why this is correct

    `echo $PWD` prints the shell's `PWD` environment variable, which holds the absolute path of the current working directory. This satisfies the requirement to display that directory without invoking an external binary, since `echo` is a shell builtin and `PWD` is maintained by the shell itself.

  • ✗

    whoami

    Why it's wrong here

    whoami reports the effective username of the invoking session, not the shell's position in the directory tree. It is tempting as another environment-query command, but it would be the right choice when a script must confirm which account it is running under, not to display the working directory.

About these practice questions

One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 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.