Courseiva
Essential CommandshardMultiple SelectObjective-mapped

LFCS Essential Commands Practice Question

Which TWO commands can be used to display the current working directory? (Choose exactly two.)

⚠ Common exam trap

Candidates often confuse `ls` (which lists files) with displaying the current directory path, or think `dirname` or `cd` can show the current directory without additional arguments.

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

echo $PWD

The shell stores the current working directory path in the environment variable `$PWD`, and `echo $PWD` prints its value. This is a reliable way to display the current directory, as the shell updates `PWD` automatically on every `cd` command.

Answer analysis

Option-by-option breakdown

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

  • ls

    Why it's wrong here

    Lists files, not current directory.

  • echo $PWD

    Why this is correct

    Correct: prints the PWD variable.

  • pwd

    Why this is correct

    Correct: prints working directory.

  • dirname

    Why it's wrong here

    Extracts directory part of a file path, not current directory.

  • cd

    Why it's wrong here

    Changes directory, does not display it.

About these practice questions

This LFCS question is part of Courseiva's 507-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 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.