Question:

Which of the following commands is used to change the working directory?

Show Hint

To move up one level in the directory tree, use{cd ..}.
This command takes you to the parent directory of the current working directory.
Updated On: Oct 13, 2025
  • cd
  • dir
  • changed
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

The correct answer is cd.
Thecd (change directory) command is used in many command-line interfaces (CLI) such as Unix, Linux, and Windows to change the current working directory. When you execute thecd command followed by a directory path, the shell or command prompt will switch to that directory. For
Example:
\[ \texttt{cd /home/user/documents} \] This command would change the working directory to the specified path.
Explanation of Other Options:
(B) dir:
Thedir command is used to list the contents of the current directory, not to change it. It is commonly used in command-line interfaces like DOS, Windows, or Linux to display files and directories in the current working directory.
(C) changed:
There is nochanged command in common shell environments (like Linux, Windows, or Unix) for changing the working directory. This is not a valid command.
Summary:

- cd is the correct command used to change the current working directory.
- dir lists the contents of the directory and does not change the directory.
- changed is not a valid command in any major shell environment.
Was this answer helpful?
0
0