Friday, September 27, 2024

Git Bash commands

 To change directories in Git Bash, you use the cd command, which stands for "change directory." Here's how you can do it:

Basic Syntax


cd [directory_path]

Examples

  1. Change to a Specific Directory:


    cd /c/Users/YourUsername/Documents

    This command navigates to the Documents folder in your user directory.

  2. Move Up One Directory:


    cd ..

    This command takes you up one level in the directory hierarchy.

  3. Change to Home Directory:


    cd ~

    This command brings you back to your home directory.

  4. Change to Previous Directory:


    cd -

    This command switches back to the last directory you were in.

  5. Using Relative Paths: If you're in /c/Users/YourUsername/ and want to go to Documents, you can simply do:


    cd Documents

Tips

  • Use Tab for autocompletion. Start typing a directory name and press Tab to autocomplete.
  • To see the current directory, use:

    pwd

Remove the Existing Directory

If you don’t need the existing odm-ops directory, you can remove it. Be careful with this command, as it will delete all contents within that directory:


rm -rf test


No comments:

Post a Comment