Difficulty: Easy
Correct Answer: cd
Explanation:
Introduction / Context:
Navigating the file system is fundamental to shell usage. Scripts and interactive sessions rely on moving between directories to access files, run commands, and manage projects. The canonical command to change the process’s working directory is short and widely supported across shells.
Given Data / Assumptions:
Concept / Approach:
The command cd is a shell built-in that changes the current directory of the running shell. It accepts absolute and relative paths. Invoked with no arguments, cd takes you to your home directory. cd - toggles to the previous directory, which is useful for quick back-and-forth navigation.
Step-by-Step Solution:
Verification / Alternative check:
Run pwd before and after cd to confirm the change. Verify permissions, as cd will fail if the user lacks execute permission on the target directory.
Why Other Options Are Wrong:
Common Pitfalls:
Using cd on paths with spaces without quoting; forgetting that cd is a built-in and cannot change the directory of a parent process; misunderstanding permissions required to enter directories.
Final Answer:
cd
Discussion & Comments