Which command displays the current working directory in Linux?
Which command displays the current working directory in Linux?
Choose the correct option from the following options
- A) ls
- B) pwd
- C) cd
- D) mkdir
Correct Answer
B) pwd
Explanation
pwd stands for “print working directory.” When you run this command, it displays the full path of the current directory you are working in. For example, if you’re in a directory called /home/testingdocs/Documents, executing pwd will output
$ pwd
/home/testingdocs/Documents
Wrong options
ls lists the files and directories in the current directory but doesn’t show the path to the current directory.
cd stands for “change directory.” It’s used to navigate different directories but doesn’t provide information about the current directory.
mkdir stands for “make directory.” It is used to create new directories but doesn’t provide any information about the current directory.
Hence, pwd is the command specifically used to display the current working directory
in Linux.