010-160 · Question #83
Which of the following commands shows the absolute path to the current working directory?
The correct answer is C. pwd. The pwd (print working directory) command outputs the absolute path of the current working directory.
Question
Options
- Awho
- Bcd ..
- Cpwd
- Dls -l
- Ecd ~/home
How the community answered
(20 responses)- B5% (1)
- C90% (18)
- D5% (1)
Why each option
The `pwd` (print working directory) command outputs the absolute path of the current working directory.
`who` displays information about users currently logged into the system, not the current directory path.
`cd ..` changes the current working directory to the parent directory; it does not display any path.
`pwd` stands for 'print working directory' and always outputs the full absolute path from the filesystem root (e.g., /home/user/documents). It takes no arguments for basic use and is a POSIX-standard utility available on all Linux systems.
`ls -l` lists the contents of the current directory in long format but does not print the directory's own absolute path.
`cd ~/home` attempts to change the working directory to a subdirectory called 'home' inside the user's home directory; it does not display a path.
Concept tested: Using pwd to display the current working directory
Source: https://man7.org/linux/man-pages/man1/pwd.1.html
Topics
Community Discussion
No community discussion yet for this question.