Reply To: bash: cd: Downloads: No such file or directory

Forum › Forums › New users › New Users and General Questions › bash: cd: Downloads: No such file or directory › Reply To: bash: cd: Downloads: No such file or directory

#58441
Robin
Member

    When I type “bash” nothing happens in terminal

    this only looks as if nothing has happened. Indeed you’ve started a new instance of bash within the terminal window. You can check this yourself: type “exit” after this first “nothing happened”. Again nothing happens, but indeed you’ve closed the new instance of bash now. Typing “exit” again will close your terminal window, since you have just closed the last running instance of bash in this window.

    You can prove this by adding a foreign language setting while starting the second bash. In a new terminal window type
    LANGUAGE=fr bash
    and enter some commands you know in there. You’ll see their output in french in my example. Only after typing “exit” now you’ll have closed the second bash instance again and you’re back on your first bash instance running your default language.

    Is this typical linux behaviour?

    Yes, this is default linux behaviour. You need to distinguish between relative and absolute paths. An absolute path starts always in the directory root “/”. Relative paths start from any point where you want (or where you just are) in directotry tree.
    In short, If you want to say “cd Downloads” you need to be in the parent folder of “Downloads”. Otherwise you have to prepend the path to where the destination folder is located, either relative or absolute. Relative paths start relative to a given starting point in directory tree. This is often where you just are. Where you are you can (in antiX) always take from the beginning of the command line. So, given you are in “/home”, and your destination folder is “Downloads”, you need to say “cd rhizome/Downloads”, which is a relative path. The same effect would have “cd /home/rhizome/Downloads”, which is an absolute path, starting with “/”. The tilde “~” is special character which expands to the home directory of current user (exactly: to what is set in the environment variable “$HOME”). So you can also say “cd ~/Downloads”. The tilde expands to “/home/rhizome”, and you have added “/Downloads”, which sums up to “/home/rhizome/Downloads”. What you’ve learned from Xecures explanation is exactly to use absolute paths, which allow you to reach any directory from any place in the directory tree directly, without need of thinking about directory structure and where you just are.
    Replace “rhizome” with any other users account name when needed. The before said goes for all other directories like e.g. “Documents”, “Images” also. To be precise, it goes for any directory you want to reach.

    to access /Documents, /Downloads

    And as you might have understood now: there is (probably) no directory “/Downloads” or “/Documents” on your system. Be aware, you have asked for an absoulute path starting with “/”. What you (probably) really wanted was the relative path from within your users home directory: “Downloads” or “Documents”. So try “cd Downloads” and “cd Documents”. Be aware linux file systems are case sensitive: “Downloads” and “downloads” is not the same item.

    This is linux basics, you should try to understand at least a bit of it.

    But when opening a terminal window, you should always find yourself in your home directory “~” which (as you now understand) expands to “/home/<username>”, so typing “cd Downloads” should be fine, as long you don’t have cd’d to some other place before. So please look which directory is displayed when opening a fresh terminal window. If this is not your users home directory, something has caused to change the starting directory of the terminal emulation. Please check the output of
    echo $HOME
    This refers to Xecures #2

    • This reply was modified 5 years, 4 months ago by Robin.

    Windows is like a submarine. Open a window and serious problems will start.