I am following a tutorial on the use of Docker/rocker containers that requires me to create a repository on my desktop. Working within ubuntu, my command line ends in "$", indicating that I am not in /root and should therefore be able to access the desktop; however, when I run cd Desktop
I receive the error message -bash: cd: Desktop: No such file or directory
. According to information gleaned from this q&a on ask ubuntu, I should only get this error if I am in /root (cmd line ending in "#"), which is not the case. What could the problem be?
2 Answers
At its most fundamental, the problem is that there is no directory named Desktop
in the location from which you are trying to execute the cd
command. You can check where that is using the pwd
command, and you can see what files and/or directories it contains using ls
.
You may be confusing two different meanings of the term "in root"
in (i.e. logged in to) the
root
user accountin (i.e. with your shell's current working directory set to)
/root
Conventionally, the bash shell indicates the first of these with a #
prompt (although there's nothing to stop anyone from changing that - it's just a matter of setting the PS1
shell variable). It's really the second that determines whether cd Desktop
will "work"; since /root
is the default home directory of the root
user account, you are initially "in /root" when you log in as root
, but that is only one of an almost unlimited number of locations that don't contain a Desktop
directory.

- 136,215
- 21
- 243
- 336
-
Thank you so much! Having realized that I couldn't possibly access Desktop from that location, I tried your suggestions but still couldn't get to Desktop after going to the top of the tree I was in. After some googling, I found that the that command <cd "C:\Users\myusername\OneDrive\Desktop"> worked from the Command Prompt window, and <cd C:\Users\myusername\OneDrive\Desktop> (no quotation marks) worked from the PowerShell. However, after having entered ubuntu in PowerShell (meaning after running
), I still could not get to the Desktop with either of these commands. Any ideas? – Mark Featherstone Aug 31 '22 at 05:52 -
"I tried your suggestions" means I navigated to the top of the tree by running <cd ..> a few times, my reasoning being that I should be able to access the Desktop from a higher/highest position. – Mark Featherstone Aug 31 '22 at 06:00
-
1@MarkFeatherstone so you are trying to access a Windows desktop folder from WSL? That information would have been useful to include in your question. – steeldriver Aug 31 '22 at 11:19
-
@MarkFeatherstone ... see for example How to get to the Windows Desktop in WSL? – steeldriver Aug 31 '22 at 11:21
-
My apologies. I am relatively new to this (meaning anything beyond GUI), and I assumed, incorrectly, that if I was using ubuntu and desktop in the same breath, then that must convey going to a Windows desktop folder from WSL. I will check out that link. – Mark Featherstone Aug 31 '22 at 13:10
To clarify, my question concerned accessing a Windows 11 desktop folder from WSL (Ubuntu). The reason I was unable to access my Windows desktop using the most popular command is explained as follows. It seems that as part of my Windows 11 installation, I chose the default setting in response to "Back up your files with OneDrive" which set OneDrive as the default save location for Desktop, Documents, and Pictures folders/files. As a result, from wsl in PowerShell, the most often suggested command for accessing the Desktop /mnt/c/Users/username$ cd Desktop
does not work. Instead, the correct command is /mnt/c/Users/username$ cd OneDrive/Desktop
where /mnt/c/Users/username$
is the prompt and cd OneDrive/Desktop
is the actual command. This correctly sets the path to Desktop through OneDrive. Of course "username" must be replaced with one's own PC username. This site was useful in clarifying the matter.
If instead one is working directly within the Ubuntu terminal (accessed from the dropdown menu in PowerShell), run cd mnt/c/Users/msfea/OneDrive/Desktop
at the command line to actually go to the Desktop. To merely see what is on the Desktop, run ls mnt/c/Users/msfea/OneDrive/Desktop
. See this site.