I can’t change directories in Git Bash

Asked

Viewed 3,978 times

-1

I try to navigate between directories but I can’t, I’ve tried everything

inserir a descrição da imagem aqui

  • After cd have to have room: cd /Users

  • 1

    @hkotsubo, in the case of git bash, the root is a kind of artificial directory (unlike the standard Unix terminal) that contains, among other things, "directories" where partitions are mounted. So cd /c/ will put the terminal at the root of the directory c, already cd /Users is not defined. You mean cd /c/Users

  • 1

    @Jeffersonquesado Perfect, I had forgotten this detail of /c. So there are 2 problems: the lack of space after cd and incorrect access to the root...

2 answers

1

the correct command is cd Users/Gustavo there is a space between cd and directory to access.

  • 1

    This is only the correct of $PWD for /c. In another directory it will not go to the desired location, which is the user folder Gustavo on Windows system

0


git bash already starts by default in your user’s directory when it is in the default directory instead of showing all the way for example: /c/Users/Gustavo it shows only one: ~, when you are in another directory and want to go to the default directory you can type the following command: cd ~, if you are in a directory and don’t know what content is in it you can also use the command ls to list the files and folders in the directory you are currently in.

  • 2

    Only the command cd has the same effect as the command cd ~. By the way, the ~ is not something of the command cd, but a specific expansion of bash, to Tilde expansion, aimed at accessing files on home yours or someone else’s. For example, if there is permission from Gustavo to read from the user Jeff the file teste.txt, Gustavo could use it cat ~Jefferson/teste.txt, that the bash will expand that to cat /c/Users/Jefferson/teste.txt and only then call the command cat

  • I know cd and ~ are two separate things, but I didn’t know that only cd would go home and ~ could access other clear home if you have permissions, thank you.

  • Thanks, you helped too much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.