How to change directories?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 19 2025
0139

To change directories in Bash, you use the cd (change directory) command. Here’s how to do it:

Basic Syntax:

cd /path/to/directory

Examples:

  1. Change to a specific directory:

    cd /home/user/Documents
  2. Change to the parent directory:

    cd ..
  3. Change to the home directory:

    cd ~

    or simply:

    cd
  4. Change to the previous directory:

    cd -

Tips:

  • Use pwd to print the current working directory after changing it to confirm the change.
  • You can use tab completion to help with directory names.

Let me know if you need further assistance!

0 Comments

no data
Be the first to share your comment!