What does the pwd
command do in UNIX?
a) Prints the working directory
b) Changes the current directory
c) Displays process information
d) Prints file contents
Answer:
a) Prints the working directory
Explanation:
The pwd
command in UNIX stands for “print working directory,” and it displays the absolute path of the current directory. This is useful when navigating through a complex directory structure and wanting to verify your current location in the file system.
When you use the pwd
command, it shows the full path starting from the root directory. For example, if you are in the /home/user/documents
directory, typing pwd
will display /home/user/documents
as the output.
Knowing the pwd
command is essential for effective navigation in UNIX environments. It ensures that users always know their location in the file system, preventing confusion and errors when working with files and directories.