220-1102 Question 236
Single answerpwdA technician is connected to a Linux workstation through a remote shell and needs to confirm which directory the session is currently using before running a script that modifies files. Which command should the technician use?
- A
pwd
- B
cd
- C
ls
- D
mkdir
Show answer and explanation
Correct answer: A
Explanation
The best answer is pwd because its purpose is to display the shell's present working directory. In real support scenarios, especially over SSH or another remote terminal session, technicians should confirm their current path before executing scripts or file-management commands to avoid changing the wrong files. This aligns with standard Linux command-line usage documented in common shell manuals and the GNU core utilities, where pwd is specifically used to print the current directory path.
- A. Correct.
Correct. The pwd command prints the present working directory, showing the full path of the current directory for the shell session. This is the appropriate command to verify location before running commands that could affect files.
- B. Incorrect.
Incorrect. The cd command changes the current directory, but by itself it does not display the current working directory in the same direct way. A technician who is unsure of the current location should use pwd first.
- C. Incorrect.
Incorrect. The ls command lists the contents of a directory, typically the current one if no path is specified. While it may give clues about where the user is, it does not explicitly display the full current directory path.
- D. Incorrect.
Incorrect. The mkdir command creates a new directory. It does not provide information about the current working directory and would not help verify the present location before making changes.