When I try to change the directory on Ubuntu, it won't let me
Olivia Zamora
When I type in
cd Desktop/Codeand then press Enter, it says
-bash: cd: DesktopCode: No such file or directoryI do have that file in my desktop, but I'm not sure how to access it and I'm not sure why it says -bash beforehand, and if that has something to do with it.
What is wrong?
Edit: I was confused and mistyped it. The error is "-bash: cd: Desktop/Code: No such file or directory". I am considering deleting ubuntu and then re-installing it, but I'm not sure if that would be too much of a hassle and if there is another way. Also, thank you to everyone who's helped me! I need to fix this in order to do an assignment and I cannot figure it out and I appreciate it so much.
34 Answers
You have typed a backslash (\) in your command instead of a forward slash (/).
The backslash is used as an escape character. Since \C (in Desktop\Code) is not a recognized escape sequence, the backslash is ignored, so your command is interpreted as cd DesktopCode.
There are details that would be helpful, but, since you are new to Unbutu, you would not know them. Let's try some troubleshooting and see what happens.
At you command prompt, what does your prompt look like? something like this:
[Gabriel@mycomputer] $ _
Can you run a directory listing?
ls -la
Can you print the current directory?
pwd
-- or --
cwd
Next, can you try just a cd command:
cd ~
if not, try to "unalias" the cd, like this:
\cd ~Notice the "backslash" before the cd. This is not the "forward slash" that you see with the question mark.
Forward Slash: /
Back Slash: \
And, try this command, just to see what it says:
which cd
Can you run any other command successfully, besides cd?
If the error message is bash: cd: DesktopCode: No such file or directory,
then the most likely explanation is that
you typed cd Desktop\Code instead of cd Desktop/Code.
In Unix & Linux,
you must use / as a separator between directory names in a pathname.
Bash is the shell, or command interpreter that you are using. That error essentially means that the shell you are using is reporting that it can’t find the directory.
Try this
cd ~/Desktop/CodeKeep in mind Linux is case sensitive, so if your directory is named code with a lower case “c” the. You will need to modify the command accordingly like this:
cd ~/Desktop/codeLet me know if that works
3