Forum › Forums › New users › New Users and General Questions › bash: cd: Downloads: No such file or directory
Tagged: no such file, terminal
- This topic has 4 replies, 4 voices, and was last updated May 2-2:56 pm by Robin.
-
AuthorPosts
-
April 24, 2021 at 1:19 pm #57988Member
rhizome
Hi,
After an Antix update, or perhaps installation of GDebi (to install Simplenote), whenever I switch directories in terminal, I get a “No such file or directory” message. After some sleuthing, I discovered I need to type “cd /home/myusername” before I can switch directories. Once I’m in myusername directory I don’t get the “error” message.However, I don’t recall ever needing to do this prior to the update/ install. (Note, after installation of GDebi, I was asked if I wanted to remove a library or file no longer required and I said “yes”. I don’t recall the file name.)
Is this typical linux behaviour? Is there a setting that can fix this to avoid having to always go to myusername directory to access /Documents, /Downloads, etc?
- This topic was modified 2 years ago by rhizome.
April 24, 2021 at 1:53 pm #57992Member
Xecure
::Maybe you were always using the terminal from your user directory.
No matter where you are in the terminal, you can navigate to the desired home directory using $HOME or ~Example1: non-root user right now in /media and I want to go to my Downloads folder
cd ~/DownloadsExample2: non-root user, that was navigating in the terminal the /home/user/Downloads/ directory and now wants to go back to their Documents folder
cd $HOME/DocumentsExample3: non-root user that just launched the terminal (should be in ~ directory) and wants to navigate to the Desktop folder
cd DesktopUsing relative paths means you want to go to a directory inside the current one you are in the terminal (example3). If you want to navigate to a folder outside the current path you are navigating in, you need to use absolute paths (example1 and 2).
When you launch the terminal you usually already are set in /home/user-name/ = $HOME = ~
what do you see on your system when launching the terminal?- This reply was modified 2 years ago by Xecure. Reason: made example 2 clearer
antiX Live system enthusiast.
General Live Boot Parameters for antiX.April 24, 2021 at 2:41 pm #57997Forum Admin
Dave
::That is a bit of an odd problem (I have not seen it).
Check /etc/passwd for the line that relates to your user and make sure the home folder is set correctly as well as the login shell to bash.
Also just for information / curiosity… what happens when you type “bash” in the terminal before anything else?Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown
May 2, 2021 at 1:44 pm #58438Memberrhizome
::Xecure: Thanks. If I ls my directory I see: antiX-cli-cc.cmd Desktop Documents Downloads Music Pictures Videos
Dave: Thanks. When I open passwd in nano I see at the top of a long list of items: root:x:0:0:root:/root:/bin/bash Is that the line you mean?
When I type “bash” nothing happens in terminal i.e. it just returns to: rhizome@antix1:~May 2, 2021 at 2:56 pm #58441MemberRobin
::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 2 years ago by Robin.
Windows is like a submarine. Open a window and serious problems will start.
-
AuthorPosts
- You must be logged in to reply to this topic.