Multiple choice unix

Which of the following commands is used to display your working directory?

  1. dir

  2. prompt \$p\$g

  3. pwd

  4. path

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The pwd command stands for 'print working directory' and displays the full path of your current location in the filesystem. This is a fundamental Unix/Linux command for navigation. The dir command lists files (primarily in Windows), while path and prompt are related to environment variables and shell prompts respectively.

AI explanation

To answer this question, you need to understand the commands used to display the working directory in different operating systems. Let's go through each option to understand why it is correct or incorrect:

Option A) dir - This option is incorrect because the "dir" command is used in Windows command prompt to list the files and directories in the current directory, not to display the working directory.

Option B) prompt \$p\$g - This option is incorrect because the "prompt \$p\$g" command is used in the Windows command prompt to customize the prompt text, not to display the working directory.

Option C) pwd - This option is correct because the "pwd" command is used in Unix-based operating systems (such as Linux, macOS) and some command-line interfaces to display the working directory.

Option D) path - This option is incorrect because the "path" command is used in Windows command prompt to display or set the command search path, not to display the working directory.

The correct answer is Option C) pwd. This option is correct because the "pwd" command is used to display the working directory in Unix-based operating systems.

Please select the most appropriate option.