Type the single command that prints the absolute path of the shell's current working directory.
LPIC-1 Exam 101-500, objective 103. GNU and Unix commands easy
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
Answer
Type the answer.
Accepted answer
pwd
Case sensitive — Linux is, and grading LS as ls would teach a falsehood.
Why
pwd (print working directory) writes the absolute path of the current directory. Bash also keeps it in the PWD variable, and the previous directory in OLDPWD, which is what `cd -` uses. Note that pwd exists both as a shell builtin and as /bin/pwd; the builtin is what you get by default.
Where this comes from
- Cited
- LPI exam objective 103.1
- What it says
- Basic command line use: determining the current working directory.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 103 and space the ones you get wrong.