LPIC-1 GNU and Unix Commands Practice Question
A help-desk technician must determine which shell built-in will display the absolute path of the directory the user is currently working in, so it can be captured in a support script. Which command should the technician use?
⚠ Common exam trap
The trap here is assuming that listing the directory contents reveals the directory's own path, when ls shows entries rather than location.
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
pwd is the standard utility for reporting the current working directory as an absolute path. Because it is also implemented as a shell built-in, it reflects the shell's tracked state and works reliably inside scripts. Redirecting or capturing its output gives the technician the exact directory path to include in a support record.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
dirname
Why it's wrong here
dirname strips the final component from a supplied path string and prints the parent portion. It requires an argument and does not inspect the shell's working directory on its own. Used alone it would error or return '.', so it cannot report the current location.
- ✗
ls
Why it's wrong here
ls lists the names of files and subdirectories within the current directory or a specified path. It does not report the directory's own absolute location, so parsing it would not reliably give the working path. It answers a different question than the one asked.
- ✗
cd
Why it's wrong here
cd changes the shell's current working directory; it produces no path output on success. Running it without arguments returns the user to their home directory, which would alter state rather than report it. It cannot supply the absolute path the script needs.
- ✓
pwd
Why this is correct
pwd prints the current working directory as an absolute path and is available both as a shell built-in and as a standalone binary. Capturing its output in a script yields the full path of the directory the user is in, which is precisely what the technician needs for the support record.
Go deeper
Related to this question
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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official LPI exam blueprint
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.