Search code examples
terminaldirectorysubdirectorycd

Can you use cd to go to a folder that isn't inclosed in the current folder?


for instance, if I had a folder, called folder A, and I was already inside folder A, and inside folder A there was a folder called folder B, could I do cd B, and then go back to folder A with cd A? Is there another method to do this? it hasn't worked when I've tried it, but maybe I'm doing it wrong...


Solution

  • Yes, you can't use cd command with space, to return to the previous directory

    Instead, you can just use cd.. to return back to the previous directory

    An example,

    C:\Users\Monish Prasad V>cd Desktop
    
    C:\Users\Monish Prasad V\Desktop>cd College
    
    C:\Users\Monish Prasad V\Desktop\College>cd..
    
    C:\Users\Monish Prasad V\Desktop>
    

    I hope this solved your issue :)